RE: [PHP] File (image) upload
| From: | John Holmes | Date: | Wed, 26 Jun 2002 03:12:00 +0000 |
| Subject: | RE: [PHP] File (image) upload | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-103896@lists.php.net to get a copy of this message | ||
$_FILES['userfile']['tmp_name']
RTM
---John Holmes...
> -----Original Message-----
> From: Simon Troup [mailto:simon.troup@digitalmusicart.com]
> Sent: Tuesday, June 25, 2002 11:02 PM
> To: php-general@lists.php.net
> Subject: [PHP] File (image) upload
>
> Hello again, still banging away at 4.2 upgrades :)
>
> This used to work in 4.1.2 ...
>
> -----------------
>
> if (is_uploaded_file ($userfile))
> {
> $memfile = fopen ($userfile, "r");
> $image = fread ($memfile, filesize ($userfile));
> $db_image = addslashes ($image);
> $db_image_name = addslashes ($userfile_name);
> $db_image_type = addslashes ($userfile_type);
> }
> else
> {
> whatever ();
> }
> do_some_db_storge ();
>
> -----------------
>
> ... but this does not ...
>
> -----------------
>
> if (is_uploaded_file ($_FILES["userfile"]))
> {
> $memfile = fopen ($_FILES["userfile"], "r");
> $image = fread ($memfile, filesize ($_FILES["userfile"]));
> $db_image = addslashes ($image);
> $db_image_name = addslashes ($_FILES["userfile"]["name"]);
> $db_image_type = addslashes ($_FILES["userfile"]["type"]);
> }
> else
> {
> whatever ();
> }
> do_some_db_storge ();
>
> -----------------
>
> I can get valid data from $_FILES["userfile"]["name"] and
> $_FILES["userfile"]["type"] (such as "pic1.gif" and
> "image/gif") but
> $_FILES["userfile"] does not contain the actual image data and just
> returns
> "array", so where is the actual binary image data that used to be if
> (is_uploaded_file ($userfile)) { } ?
>
> I think I'm missing something pretty elementary.
>
> I'm running PHP 4.2.1 on MacOSX/Apache 1.3.23 if that means anything
in
> this
> case.
>
> Regards
>
> Zim
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php