This is my code:
$uploaddir = '/temp/'; $uploadfile = $uploaddir.basename($_FILES['file']['name']); if (move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile)) send_OK(); else send_error("ERROR - uploading file");
I tried using ftp_fput, ftp_put, move_uploaded_file for uploading, renaming, copying, anything else I could use. Nothing seems to work.
I can't understand what the problem is because move_uploaded_file only returns true or false and there is no error code.
help??
But you have to do it.
This is what error messages are for.
Do you see any error messages when something goes wrong? If not, then you must check the error log.
Add this line to the top of the code
Also this if it is your local (non-live) server
So you can see the error on the screen
For file uploads, you must first check
$_FILES['file']['error'])
. If it is not0
, see the man page for the actual message.Are you sure the target directory has write permissions for
groupworld
? i.e. the third number in the permission representation? Files uploaded by php are owned by and belong to thewww-data
You can change ownership in the following ways