0

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.

Andrew Barber
  • 39,603
  • 20
  • 94
  • 123
who-aditya-nawandar
  • 1,334
  • 9
  • 39
  • 89
  • 1
    Check this answer [http://stackoverflow.com/questions/12531408/setting-php-tmp-dir-php-upload-not-working][1] [1]: http://stackoverflow.com/questions/12531408/setting-php-tmp-dir-php-upload-not-working – Janak Prajapati Feb 07 '14 at 12:51

2 Answers2

0

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

Pierre Granger
  • 1,993
  • 2
  • 15
  • 21
  • 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. – who-aditya-nawandar Feb 07 '14 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 07 '14 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? – who-aditya-nawandar Feb 07 '14 at 13:13
0

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
geisterfurz007
  • 5,292
  • 5
  • 33
  • 54
Ferrakkem Bhuiyan
  • 2,741
  • 2
  • 22
  • 38