Hey all, I need a little help with moving a file on the server after an 
upload.

Our company site is hosted, so I don't have full access to the 
configuration files, but I can do a PHP_info dump if you need more 
clarification. Using 4.0.1pl2.

What I'm doing is uploading a file from a form, and that goes through just 
fine. I can print the file name to a database, along with the size.

The trouble is, no matter how I try to move it from the tmp directory, I 
get the same error. I've tried referencing it by the name given in the 
form, I've tried referencing it by $_Files. No matter how I call it, it 
never seems to go back to the tmp directory to look for the file. Here's a 
sample error:

Warning: Unable to create '/test/data/test.txt': No such file or directory 
in /usr/local/www/vhosts/healthtvchannel.org/htdocs/test/upload.php on line 17

That's with using:

         copy("{$UploadedFile}","/test/data/".$UploadedFile_name);

$UploadedFile being the name I'm using. Both variables seem to be returning 
correctly. $UploadedFile returns the temp name, and $UploadedFile_name 
returns the actual name. The file is also far under the maximum file size. 
The /test/data has Nobody write permissions, I know because I'm writing to 
a file in it with another script, and there's no file in there with the 
same file name to cause overwriting ownership conflicts.

So where am I being stupid?

Here's the full code:


<?
         print($UploadedFile);
         print("<br />");
         $filename = $UploadedFile_name;
         print "$filename was uploaded successfuly<br>\n";
         $realname = $UploadedFile_name;
         print "realname is $realname<br>\n";
         print "copying file to uploads dir<br>\n";
         copy("{$UploadedFile}","/test/data/".$UploadedFile_name);
?>

<form enctype="multipart/form-data" action="<?$php_self?>" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="4096">
<input name="UploadedFile" type="file">
<input type="submit" value="upload">

--
S. Keller
UI Engineer
The Health TV Channel, Inc.
(a non - profit organization)
3820 Lake Otis Pkwy.
Anchorage, AK 99508
907.770.6200 ext.220
907.336.6205 (fax)
Email: [EMAIL PROTECTED]
Web: www.healthtvchannel.org


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to