error while moving an uploaded image
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phptMeFd4' to './photogallery/4bf2806a0d80c4ad68aa5e4e20dscn6842.jpg' in /some path/addsplashphoto.php 开发者_如何学JAVAon line 49
am trying to upload photo to a destination folder in my server but each and every time an error like above is appearing..same code is working quite well at localhost(i have set changed the file permissions of my server folder but still have the same problem )
somebody please tell me the reason of this error...
Make sure that:
- You are specifying the correct path
- Folder has write permissions, chmode to 755
- You have specified the encoding type attribute in the form set to multi-data
- Try prefixing the path with
$_SERVER['DOCUMENT_ROOT']
- also make sure that
./photogallery
dir exists.
Try to use an absolute path instead of a relative path. For example if your code looked like:
$path = "./photogallery/4bf2806a0d80c4ad68aa5e4e20dscn6842.jpg";
move_uploaded_file($_FILES['something']['tmp_name'],$path);
change that to:
$path = dirname(__FILE__)."/photogallery/4bf2806a0d80c4ad68aa5e4e20dscn6842.jpg";
move_uploaded_file($_FILES['something']['tmp_name'],$path);
Obviously, change the path to be the correct path :-)
精彩评论