Re: Safe mode upload

From: Date: Tue, 08 May 2001 18:41:45 +0000
Subject: Re: Safe mode upload
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-51953@lists.php.net to get a copy of this message
Awhile ago there was some discussion on irc #php , this use was proposed (by onki) : $tmp_name = $HTTP_POST_FILES['userfile']['tmp_name']; move_uploaded_file ($tmp_name, '/home/httpd/html/upload/example.zip'); chmod('/home/httpd/html/upload/example.zip', 0644); And it works. move_uploaded_file() is the key here. Haven't personally tried it like this as the safe mode server I have access to is 4.0.2 and move_uploaded_file is a 4.0.3 function http://www.php.net/manual/en/function.move-uploaded-file.php http://www.php.net/manual/en/features.file-upload.php Also, what you can do is get a script called chuid from here : http://www.srparish.net/scripts/ It must be installed by sysadmin. Then, users do something like this : ... <input type="file" name="file"> ... passthru ("chuid $file 1033"); copy($file, "/path/to/uploads/$file_name"); Something like that. The above (1033) is the users uid which of course is different for everyone. If anyone has comments to add/change to this post, please do so. Also upon review of the php4.0.5 CHANGELOG, note the following entry : "Allow access to uploaded files in safe_mode. Beware that you can only read the file. If you copy it to new location the copy will not have the right UID and you script won't be able to access that copy. (Thies)" http://php.net/ChangeLog-4.php Regards, Philip On Tue, 8 May 2001, php wrote: > > Hi everyone. > > I have trouble uploading files while in safe mode > .Warning: SAFE MODE Restriction in effect. The script whose uid is 206 is > not allowed to access /tmp/php6wtDUc owned by uid 0 > Can someone help me pass around this problem? > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#51953) next »