Apache places uploaded files in /tmp. Can I change that to another directory?
Solution 1
The temporary file location seems to be set by the scripting program that you choose. In PHP, for example, the temporary upload location is set by the upload_temp_dir
directive.
upload_temp_dir = /somewhere/else
As far as Ruby on Rails goes, I found this ServerFault question that describes it as a change to the 'tmpdir' property of Rails' initializer object.
class Dir
def self.tmpdir
"/your_directory/"
end
end
To parrot the user who answered this question in the other thread, make sure that the folder you specify is writable by the user for Apache.
Solution 2
FYI the php.ini file says:
; Temporary directory for HTTP uploaded files (will use system default if not
; specified).
; http://php.net/upload-tmp-dir
;upload_tmp_dir =
so its 'tmp' vs 'temp'. This at least worked for me.
Related videos on Youtube
GSP
Updated on September 18, 2022Comments
-
GSP over 1 year
Is there a configuration that changes the directory where apache web server temporarily places uploaded files? I have access to httpd/conf.d
I'm on a machine where /tmp is very size constrained and have a requirement to allow file uploads that are larger than the available space on /tmp.
Environment: fedora 18, apache web server 2.4.6-2, passenger and ruby on rails.
EDIT: there's some discussion around the office that it's passenger (because this is a ruby on rails app) not apache that determines the location of the temporary file upload. I'm going under the assumption that it's apache but please correct me if I'm wrong.
-
GSP over 10 yearsthanks for the link to that other question as well. It ended up being solved by setting the TMPDIR env variable so I didn't need to monkey patch
Dir
but you sent me in the right direction.