• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2185
  • Last Modified:

modify upload_tmp_dir for file uploads

I would like to move the location of the temporary file upload directory for image uploads.. right now it is pointed at a different partition than the rest of my php application, and moving the files from one partition to another is taking too much time (big files are involved).  

I don't have access to the php.ini file, so i can't modify it there, but i have been told that i can add something to a .htaccess file that will do it for me (override the php.ini file i guess).. what i am looking for is the syntax for the .htaccess file that will let me change the temp upload folder to be pointing at whatever folder i want it to.

I think it is the upload_tmp_dir value in the ini file, but i could be wrong about that.

The way the app works is that users go to a page in the following directory:
/usr/home/xxxxx/public_html/administrator/events

They select the files that they want to upload and the files get uploaded via a java applet in the following directory:
/usr/home/xxxxx/public_html/administrator/includes  
(the applet is called from the page in the first mentioned directory)

The java applet gets them uploaded (via normal post data submission) and then call another file in same directory as the applet (/usr/home/xxxxx/public_html/administrator/includes) that processes and moves the files to their final/non-temp location.

Like i said earlier, I need to know how to select which folder is used as the temporary file upload directory.
0
Caliguian
Asked:
Caliguian
  • 2
2 Solutions
 
mensuckCommented:
Hi

Although many INI values can be set via your script or maybe htaccess, *upload_tmp_dir* is a system related value that can only be set in your PHP.INI file or via the server config (Apache httpd.conf) or config.ini in many other servers.


Suzanne
0
 
CaliguianAuthor Commented:
so i cannot set this value locally?
0
 
jdpipeCommented:
No. Check the ini_set reference, and note that upload_tmp_dir is of type PHP_INI_SYSTEM. All other types can be set in your htaccess files using the php_admin_value Apache directive.

JP

Table 2. Definition of PHP_INI_* constants

Constant Value Meaning
PHP_INI_USER 1 Entry can be set in user scripts
PHP_INI_PERDIR 2 Entry can be set in php.ini, .htaccess or httpd.conf  
PHP_INI_SYSTEM 4 Entry can be set in php.ini or httpd.conf  
PHP_INI_ALL 7 Entry can be set anywhere

0
 
jdpipeCommented:
If you really must use your own directory, you could consider uploading with a custom HTTP POST - for example embed your file-being-uploaded in an XML packet. This would require that you customised your Java applet. I wouldn't recommend this course of action though.
JP
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now