Problem uploading a File
Posted: Wed Jul 21, 2010 6:10 am
Hello.
First off all, i'll try to explain myself quite as possible since i'm really new into PHP programming and only know really small/basic things.
Well, the problem is that i'm trying to do a php file that can upload a file (a photo) into a server and at the same time grab the name of the photo and insert into a mysql database. Anyway, i'm only giving you the php code, since i'm not having any trouble with the mysql part.
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phptJTqOf' to 'SGE/colaborador/imagesfoto.jpg' in /home/sge/public_html/colaborador/upload.php on line 8
Existe um problema no upload da foto.
I thing it has something to do with permissions, but i'm not quite sure. Really don't know what to do. It would be great an answer.
Hope i gave enough information.
P.S1.: In this part i'm only testing the code in local directory, not in the actual server. But just so you to know... i have the same error when i change directory.
P.S2.: I think it's not necessary the html, as i assure is nothing to do with that, lol.
First off all, i'll try to explain myself quite as possible since i'm really new into PHP programming and only know really small/basic things.
Well, the problem is that i'm trying to do a php file that can upload a file (a photo) into a server and at the same time grab the name of the photo and insert into a mysql database. Anyway, i'm only giving you the php code, since i'm not having any trouble with the mysql part.
ERROR: Warning: move_uploaded_file(SGE/colaborador/imagesfoto.jpg) [function.move-uploaded-file]: failed to open stream: No such file or directory in /home/sge/public_html/colaborador/upload.php on line 8<?php
$dir = "SGE/colaborador/images/";
$dir = $dir . basename( $_FILES['uploadedfile']['name']);
if(move_uploaded_file( $_FILES['uploadedfile']['tmp_name'], $dir)) {
echo "O ficheiro ". basename( $_FILES['uploadedfile']['name']). " foi descarregado e a informação adicionada à Base de Dados"; }
else{
echo "Existe um problema no upload da foto.";
}
?>
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phptJTqOf' to 'SGE/colaborador/imagesfoto.jpg' in /home/sge/public_html/colaborador/upload.php on line 8
Existe um problema no upload da foto.
I thing it has something to do with permissions, but i'm not quite sure. Really don't know what to do. It would be great an answer.
Hope i gave enough information.
P.S1.: In this part i'm only testing the code in local directory, not in the actual server. But just so you to know... i have the same error when i change directory.
P.S2.: I think it's not necessary the html, as i assure is nothing to do with that, lol.