I think this is very popular question, however I can't find information I interested in, hope you help me.
I new to server administration things, so don't throw stones at me:)
I install nginx to my debian virtual server, and already install php, mysql and all I was need to. But when I start use my php scripts I found that I can't upload files through html form.
I made some test page and I see that, after form was submitted I can see the $_FILES['tmp_name'], but PHP function move_uploaded_file doesn't work. It doesn't moved the file.
So that's why I start googling and find lot of info about nginx_upload module and so on.
Is it posible to config nginx to upload a file, or I must install nginx_upload module to do so?
What I must to do for allow upload files to my nginx server. Thank you.
Best Answer
Since
$_FILES['fieldname']['errors']
contains 0 (which isUPLOAD_ERR_OK
), the actual upload has succeeded. What's failing is the attempt to move the temporary file to the location you specified, which is whymove_uploaded_file()
is returning false. You're doing something like this:The most likely problem is that PHP doesn't have write permission to the directory you specified as the second parameter. Find out what user PHP is running as (probably something like
www-data
), and make sure that that user has write permission: