remote image uploads.
| From: | Tyler Longren | Date: | Wed, 25 Jul 2001 16:24:22 +0000 |
| Subject: | remote image uploads. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-59569@lists.php.net to get a copy of this message | ||
Hello everyone,
I've hunted on google, read the list archives. Here's what I've been
fooling with to upload the file:
$data = addslashes(fread(fopen($picture, "r"), filesize($picture)));
$len = strlen($data);
if ($fp = fopen("$image_path/$picture_name",
"wb")) {
if ($size = fwrite($fp, $data, $len)) {
print "<font face=Arial
size=2>Thanks, the image has been added to our database.</font>";
fclose ($fp);
}
else {
print "<font face=Arial
size=2>$picture_name couldn't be written to, perhaps some permissions are
wrong?";
}
}
else {
print "<font face=Arial
size=2>$picture_name couldn't be opened (or created), please try
again.</font>";
}
Here's the relavent form field:
<input type=file name=picture>
And here's the errors:
Warning: fopen("C:\\WINDOWS\\Desktop\\whiterain.jpg","r") - No such file or
directory in /home2/aanr.com/www/cyber_bulletin/admin/add.php on line 84
Warning: Supplied argument is not a valid File-Handle resource in
/home2/aanr.com/www/cyber_bulletin/admin/add.php on line 84
Warning: fopen("/home2/aanr.com/www/images//","wb") - Is a directory in
/home2/aanr.com/www/cyber_bulletin/admin/add.php on line 86
couldn't be opened (or created), please try again.
Anyone know how to fix this? I'm uploading an image from a windows hd to a
linux server.
Tyler Longren
Captain Jack Communications
tyler@captainjack.com
www.captainjack.com