Quote from my other post (not in correct section)
So, anyone can help me or give me a tip to solve this problem ??? Maybe a PHP code ???
this is my upload PHP script:
Thanks !
| Quote: |
| [ENG]
I'm making (or trying) my own image gallery in PHP and MySQL, the script works fine, i can upload images perfectly and these are saved on a especific folder. I'm working under a subdomain (sub.domain.frihost.net). My files are in "public_html/subdomain" and images are in "public_html/subdomain/images", but when i try to see those images Error 403 appear. The folder permission is 777 like old file in there, but new uploaded files dont. I must set permission to 777 manually every file uploaded to see it. My question: does exist any folder with public acces for this ??? I mean, i dont want to set 777 every file uploaded Thanks a lot !!!!!!!!!!!!!!!!! |
So, anyone can help me or give me a tip to solve this problem ??? Maybe a PHP code ???
this is my upload PHP script:
| Code: |
|
<?php $server="localhost"; /* Nuestro server mysql: */ $database="xxxxxxxx"; /* Nuestra base de datos */ $dbpass="xxxxxxxxx"; /*Nuestro password */ $dbuser="xxxxxxx"; /* Nuestro user */ //datos del arhivo $nombre_archivo = $HTTP_POST_FILES["userfile"]["name"]; $tipo_archivo = $HTTP_POST_FILES["userfile"]["type"]; $tamano_archivo = $HTTP_POST_FILES["userfile"]["size"]; //compruebo si las características del archivo son las que deseo if (!((strpos($tipo_archivo, "gif") || strpos($tipo_archivo, "jpeg")) && ( $tamano_archivo < 1000000))) { echo "La extensión o el tamaño de los archivos no es correcta. <br><br><table><tr><td><li>Se permiten archivos .gif o .jpg<br><li>se permiten archivos de 100 Kb máximo.</td></tr></table>"; ?> <script language="javascript" type="HTML 4.0"> setTimeout("url()",3000); function url() { window.history.back(); } </script> <?php } else { $nom_img= $nombre_archivo; $directorio = 'fotos/'; if (move_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name'],$directorio . "/" . $nom_img)) { $diaactual= date("d"); $mesactual= date("m"); $anoactual= date("Y"); $fecha= $diaactual . "/" . $mesactual . "/" . $anoactual; //NOS CONECTAMOS A LA BASE DE DATOS $link=mysql_connect($server,$dbuser,$dbpass); $query="INSERT INTO fotosup (titulo,comentario,ruta,autor,fecha) VALUES ('$titulo','$comentario','$nom_img','$autor','$fecha')"; $result=mysql_db_query($database,$query,$link); if(mysql_affected_rows($link)) { echo "Noticia ingresada correctamente"; } else { echo "Error introduciendo la Noticia"; } /* Cierre del else */ } else { echo "error al subir la foto"; } } ?> |
Thanks !
