Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I was using the system default temp folder (C:\Xampp\tmp) for file uploads. But now I need to specify a temp folder to store the temp files before upload. Is this the right function?

ini_set('upload_tmp_dir','../../tempuploads'); 

And how to get the file from there?

Till now I was using this:

$file_tmpname = $_FILES["ctrlFileUpload"]["tmp_name"];

I hope this is possible.

share|improve this question

2 Answers 2

It's not temp file "before" upload but temp during and just after upload. If your ini_set works file tmp_name will be okay and you just have to use move_uploaded_file after that tu push your file in a correct f

share|improve this answer
    
you probably dint understand what I need. I need to get this file from the temp folder so that I can use it to post to another server. –  Adi Feb 7 at 12:43
    
but why the temp dir is important if you just need to retreive the file ? You can't just get it, put it in a regular folder (not a temp one), and then move to the other server ? I don't know what you mean by "temp folder to store the temp files BEFORE upload... –  Pierre Granger Feb 7 at 12:52
    
I have set the temp dir in php.ini for XAMPP. Can you tell me where would I need to set the temp dir for a linux server? –  Adi Feb 7 at 13:13
You can set upload_tmp_dir in the php.ini file:

Set upload_tmp_dir to a safe location

upload_tmp_dir = /var/www/foo.bar/sessions

ini_set(‘upload_tmp_dir’, ‘/path/to/dir’);

The setting can also be applied in apache’s httpd.conf file, or an .htaccess file:

# Set upload_tmp_dir to a safe location

php_value    upload_tmp_dir    /var/www/xxx.bar/sessions
share|improve this answer

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.