PHP POST method upload -
i'm having trouble debugging why processing of file upload not working. i've created html5 file uploader on page calls upload.php.
upload.php
// file should saved in same folder upload.php $uploaddir = '/'; $uploadfile = $uploaddir . basename($_files['filetoupload']['name']); echo '<pre>'; if (move_uploaded_file($_files['filetoupload']['tmp_name'], $uploadfile)) { echo "file valid, , uploaded.\n"; } else { echo "possible file upload attack!\n"; } echo 'here more debugging info:'; print_r($_files); print "</pre>";
the result of debug shows me following:
move_uploaded_file appears return false , not being able move uploaded file temp location specified location.
i've made sure set permissions on folder upload.php resides , file should save 777.
question there way more information why file not saved me understand did wrong ?
// file should saved in same folder upload.php $uploaddir = '/';
/something
absolute path; $uploaddir points root of file system (that's not same document_root of webserver). webserver process doesn't have write permissions there.
take @ __dir__ "constant" @ http://php.net/language.constants.predefined
Comments
Post a Comment