1
votes

I would like to upload files to my server using php and xmlhttprequest in POST.

But my /tmp dir is too small, so I created a new tmp folder for upload with 777 access, and I changed the vhost conf file to set upload_tmp_dir to this folder's path.

If i display phpinfo, this folder appears as the upload_tmp_dir.

But when I upload a file, nothing appears in the new tmp folder but I can see this type of file in /tmp : 20140321-165951-Uyxh938AAQEAACcDEeEAAAAC-request_body-uW4YRM

What can I do to get php upload to use the tmp folder I created ?

Thanks a lot for your help

1
Maybe too obvious, but did you restart Apache after the change? - BarryDevSF
I was going to mention that earlier also @BarryDevSF - Funk Forty Niner
See this answer which may help. - Funk Forty Niner
This Q&A may also explain it. I quote from the answer given: "PHP will delete uploaded files when the script exits, unless you've moved/copied the file somewhere else yourself. The upload process isn't a "do it now and come back later to deal with it" system. It's "deal with it now, or it's gone"." - Funk Forty Niner
Yes I restarted the apache server. And in my php page I use move_uploaded_file($_FILES["myfile"]["tmp_name"],$sNewPath); - Sylvain

1 Answers

0
votes

to upload your files into tmp folder, your should use this

file_put_contents(sys_get_temp_dir().'/file.txt', 'content');