Re: File Upload and ftp transfer problem
| From: | Jason Wong | Date: | Thu, 27 Mar 2003 19:48:23 +0000 |
| Subject: | Re: File Upload and ftp transfer problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-141304@lists.php.net to get a copy of this message | ||
On Friday 28 March 2003 03:16, Hugh Danaher wrote:
> I'm trying to get the following script to ftp transfer an uploaded image
> file so as to get around a file permission problem. The upload portion of
> this works without problem, the ftp portion doesn't spit out any errors
> either, but the file transfered is just the name of the uploaded temp file
> and not the file itself. If I do a filesize() on $file_stream, I get 44K
> (the size of the image uploaded), I then transfer this var to the ftp
> function but what gets ftp and saved as a file is only 14 bytes. The saved
> file has "/tmp/phpDcJSOq" as its entire contents. The upload scrip is
> below.
It's doing exactly what you're telling it to do.
$file_stream=$HTTP_POST_FILES['userfile']['tmp_name'];
This only contains the _name_ of the temporary file which contains the
contents of your uploaded file.
What you need to do is send the _contents_ of the file pointed to by
$file_stream. Take a look at fread() and/or file().
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
I do not find in orthodox Christianity one redeeming feature.
- Thomas Jefferson
*/