I'm working on file upload via a webpage with a progress bar using Valums file uploader. Almost everything works fine, but I'm not able to change the default tmp directory, where the file is stored during the upload.
Files should be stored in /upload
directory and not in default system /tmp
directory, because /tmp
is mounted in a RAM disk which has its size limited to 4 MB and user will be uploading files around 10 MB.
I've searched lots of webpages, but none of solutions worked.
I've set temp directory in php.ini
:
upload_tmp_dir =/upload
I've set permissions to the /upload
dir, and apache is owner of the file, so the directory is definitely writable by PHP.
I've set the target path in file uploader to /upload
, because I want the files to be stored after the upload also in this directory. The final result is small files are being uploaded successfuly, but files larger than 4 MB fail to upload-the only reason of this behaviour that comes to my mind is that files are stored in /tmp
during upload. To be sure, I've checked it with sys_get_temp_dir()
and the result was /tmp
-so PHP ignores my php.ini directive or there is some other way to set where files are stored during upload.
Oh, and the last information: open_basedir
isn't set, so the PHP access to disk is only limited by file permissions.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…