Re: Uploading a file
| From: | Maxwell Hung | Date: | Tue, 06 Jun 2000 07:45:42 +0000 |
| Subject: | Re: Uploading a file | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-245@lists.php.net to get a copy of this message | ||
If you're just uploading a file to a directory and not
appending another etc.. there's an easier way to do
it.
This works for me
<?
// Copy the file to C:\upload.txt. Remember to
escape backslashes!
if (copy($userfile, "C:\\$userfile_name")) {
echo("<B>File successfully copied!</B>");
} else {
echo("<B>Error: failed to copy file...</B>");
}
// Destroy the file now we've copied it
unlink($userfile);
?>
M@x
--- Henri Sora <sorahen@saunalahti.fi> wrote: > Hello!
>
> I've read the posts of Maxwell and Adrian. I've got
> similar problem
> and I don't see any way around it.
>
> The facts:
>
> 1. Windows NT SP6, Apache 1.3.12, PHP 4.
> 2. A Form where I've got <INPUT TYPE="file"
> NAME="input_file">...
> 3. A PHP script that says:
> [...]
> $write_dir = "d:\\temp\\";
> $fpointer =
> fopen($write_dir.$input_file_name,"w");
> fputs($fpointer, $input_file);
> fclose($fpointer);
> [...]
> 4. PHP.INI has upload_tmp_dir = d:\temp
>
> Everything goes fine, but the content of the
> uploaded file is lost
> and it is replaced with D:\\temp\php2
>
> Any ideas? I am out of those and in rush.
>
> TIA,
> Henri
>
_____________________________________________________________________
> http://iki.fi/sora, tel: 040 53 40 405, 03 616 6726
> fax: 03 313 92138
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, e-mail:
> php-windows-unsubscribe@lists.php.net
> For additional commands, e-mail:
> php-windows-help@lists.php.net
> To contact the list administrators, e-mail:
> php-list-admin@lists.php.net
>
__________________________________________________
Do You Yahoo!?
Yahoo! Photos -- now, 100 FREE prints!
http://photos.yahoo.com