Re: copied file is empty
| From: | Kevin Stone | Date: | Mon, 14 Apr 2003 20:04:05 +0000 |
| Subject: | Re: copied file is empty | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-143833@lists.php.net to get a copy of this message | ||
----- Original Message -----
From: "Mike Tuller" <php@ce.anoka.k12.mn.us>
To: "php mailing list list" <php-general@lists.php.net>
Sent: Monday, April 14, 2003 11:41 AM
Subject: [PHP] copied file is empty
> I was able to get a file to copy to a folder on my web server, but when
> I open the file, it is empty. The file on my computer has data in it,
> but the files that is on the server has none. Why would this be? here
> is my code.
>
> $importFile = $_FILES['importFile'];
> $importFileName = $_FILES['importFile'] ['name'];
>
> copy ($importFileName, "./tmp/" .$importFileName)
> or die ("Couldn't copy the file.");
>
> echo "The file $importFileName was copied successfully!";
>
> Mike
The errant space was already methoed. But also you are copying a blank
file. What's stored in $_FILES['inportFiles']['name'] is just the name of
the original file, not the path of the uploaded file. The path of the
uploaded file is stored in $_FILES['importFiles']['tmpname']. So that
should be the first input to the copy function.
HTH,
Kevin