move_uploaded_file() was created to solve the safe_mode issue
Here's some sample code...
------------index.html -----------
<body>
<form enctype=multipart/form-data action=upload.php method=post>
<input type=hidden name=MAX_FILE_SIZE value=100000>
<input type=file name=userfile>
<input type=submit value="Sent It">
</form>
</body>
--------upload.php ------------
<?
print "<pre>
File: $userfile
Name: $usrfile_name
Size: $userfile_size
######";
print_r($HTTP_POST_FILES);
$upload_dir="/www/TestUpload/deposit";
if (move_uploaded_file($userfile, "$upload_dir/$userfile_name")) {
echo "Move Worked\n";
chmod("$upload_dir/$userfile_name", 0444); /convert to r--r--r-- /
}
else
echo "Move Failed\n";
?>
Here's manual info..
<http://www.php.net/manual/en/function.is-uploaded-file.php>
<http://www.php.net/manual/en/function.move-uploaded-file.php>
<http://www.php.net/manual/en/features.file-upload.php>
Hope that sets you right
Jadow
mark wrote:
I have a problem of downloading word documents and images.
It started when I could upload on to my test system but once down on the host I was receiving allsorts of rejection.
I finally worked out it was the host
You are trying to access /var/tmp/phpx18314. You may not access files
The host has safe_mode on so that I have to uploaded the files into your own
directory
I am new to php thaw have solved most problems this one is still bugging me.
I think it is something to do with Dir?
Grateful for all help