Thanks John. I've simplified and improved the quote per your suggestions, but still no dice. (I'[m running OS X 10.2.8.) Here is the code:

// MOVE FILE
if (move_uploaded_file($_FILES['userfile']['tmp_name'],$_FILES['userfile'][ 'name'])) {
echo "Success!";
} else {
echo "NO!!!";
}


Here are the results:

NO!!!
Array ( [img_photo] => Array ( [name] => apache_pb.gif [type] => image/gif [tmp_name] => /var/tmp/phpvnTFqr [error] => 0 [size] => 2326 ) )


Should the tmp directory maybe be set elsewhere? (If so, how can that be done? I've looked at the httpd.conf file, but there is no entry for upload tmp directory.)

Many thanks in advance.

...Rene

On Wednesday, October 29, 2003, at 12:41 PM, John Nichel wrote:

René Fournier wrote:
I'm trying to get a little upload script working... But I can't seem to copy the tmp file to my local web directory (btw, do I really need to specify the path, or can I just use a filename, and the file will be written to the same directory as the PHP script??). Anyway, here is the code:
$realname = $_FILES['userfile']['name'];
if(copy($_FILES['userfile']['tmp_name'],
'/Users/rene/Sites/renefournier/titan/res/'.$realname)) {
echo $realname.' uploaded';
} else {
echo $realname.' could not be uploaded';
}

PHP has built in functions to move the temp file for you....


http://us3.php.net/manual/en/function.move-uploaded-file.php

echo '<br>';
echo "name: ".$_FILES[$fld]['name'];
echo '<br>';
echo "type: ".$_FILES[$fld]['type'];
echo '<br>';
echo "size: ".$_FILES[$fld]['size'];
echo '<br>';
echo "tmp: ".$_FILES[$fld]['tmp_name'];
echo '<br>';

Do you know about print_r?


<pre>
<?php print_r ( $_FILES ); ?>
</pre>

--
By-Tor.com
It's all about the Rush
http://www.by-tor.com

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



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



Reply via email to