note 9240 added to Handling file uploads

From: Date: Tue, 24 Oct 2000 13:48:33 +0000
Subject: note 9240 added to Handling file uploads
Groups: php.notes 
Request: Send a blank email to php-notes+get-6931@lists.php.net to get a copy of this message
Safe mode:<br><br> Something that *almost* caught me out, and nearly prompted me to submit a bug report before I spotted a similar one (with solution).... that isn't documented here.<br><br> If you are running with safe_mode on, your scripts whose uid's are not 0 will not be able to access uploaded files from /var/tmp/php[XYZ] (or whatever your tmp dir is), because as the file is written to the directory it appears to take on the ownership from that directory.<br><br> Solution: Set upload_tmp_dir in your php.ini file/Apache config, to be "./tmp/". This causes any uploaded files to be written to the tmp subdirectory from the same directory as the script was executed from, e.g, a file processed by /usr/local/apache/htdocs/test/upload.php will be written to /usr/local/apache/htdocs/test/tmp/file.txt<br><br> The ballache is you've got to create those tmp directories by hand (and generally 777 them). What would be nice is if files were written to /var/tmp/phpXYZ and then chowned to the respective safe_mode UID/GID.<br><br> -Steven http://www.php.net/manual/features.file-upload.php

« previous php.notes (#6931) next »