"Unable to access" with move_uploaded_file() PHP
The 开发者_如何学JAVAfunction move_uploaded_file() isn't working on my server and I really dont know why. the error:
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to access MYADDRESS/img-19.png in MYADDRESS/index.php on line 660
I gave to the folder which I upload files chmod 777. any solution? im sure 100% the problem isn't in my code.
Make sure you have it in the $src, $dest
order:
move_uploaded_file($_FILES["field"]["tmp_name"], 'foo.png');
Also, check PHP settings, especially safe_mode and base dir restrictions.
Side note: Don't chmod your folders to be world writable! Change the group of the folder to be that of the webserver, and use 775. Last thing you need is something like an SQL injection from MySQL writing a PHP file into that folder.
精彩评论