Sign up ×
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute:

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

share|improve this question
    
Maybe too obvious, but did you restart Apache after the change? – BarryDevSF Mar 21 '14 at 16:26
    
I was going to mention that earlier also @BarryDevSF – Fred -ii- Mar 21 '14 at 16:30
    
See this answer which may help. – Fred -ii- Mar 21 '14 at 16:31
    
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"." – Fred -ii- Mar 21 '14 at 16:35
    
Yes I restarted the apache server. And in my php page I use move_uploaded_file($_FILES["myfile"]["tmp_name"],$sNewPath); – Sylvain Mar 21 '14 at 16:49

1 Answer 1

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

file_put_contents(sys_get_temp_dir().'/file.txt', 'content');
share|improve this answer
    
My goal is not to upload content in tmp dir. I'm using an html form to upload file on the server, but the tmp folder is too small on this server, and I'd like to use an other folder as php upload tmp dir, but it does not work. – Sylvain Mar 22 '14 at 23:04
    
maybe your settings wrong or your new upload_folder has wrong place try this : upload_tmp_dir = /root/tmp/upload your site location - /root/www/ – Vadim Mar 24 '14 at 13:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.