Re: remote image uploads.

From: Date: Wed, 25 Jul 2001 16:46:09 +0000
Subject: Re: remote image uploads.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-59572@lists.php.net to get a copy of this message
I found the problems: 1. I shouldn't have been using stripslashes() when putting the picture on the filesystem. This would have been necessary for adding the image to a database. 2. Put ENCTYPE=multipart/form-data in <form>. My bad, I didn't include the <form> part of my code in the email. Tyler Longren Captain Jack Communications tyler@captainjack.com www.captainjack.com ----- Original Message ----- From: "Tyler Longren" <tyler@captainjack.com> To: "php-general" <php-general@lists.php.net> Sent: Wednesday, July 25, 2001 11:24 AM Subject: [PHP] remote image uploads. > 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 > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#59572) next »