Re: [PHP] file uploads

This is a discussion on Re: [PHP] file uploads within the PHP General forums, part of the PHP Programming Forums category; Hi Chris, I think you're referring to this: $_FILES["image"]["tmp_name"] In my class I ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 12-01-2003
Jon Bennett
 
Posts: n/a
Default Re: [PHP] file uploads

Hi Chris,

I think you're referring to this:

$_FILES["image"]["tmp_name"]

In my class I pass this as a reference:

$aArgs['Image'] = $_FILES["image"];

Then, $aImage in my storeBigImage() method is passed the
$aArgs['Image'] when it's called:

$this->storeBigImage($productID, $aArgs['Image']);

All the image details are there because otherwise functions like
getimagesize would fail, it just won't save the resized or, if the
dimensions of the uploaded image aren't bigger than my max width and
height, original image, and I really have no idea why!!

Thanks,

Jon


jon bennett | jon@jben.net
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

J b e n . n e t

91 Gloucester Rd, Trowbridge, Wilts, BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/



On 1 Dec 2003, at 13:36, Chris Hayes wrote:

> PHP first gives the file a temporary name on a temporary location.
> This name is not the same as the name given in the upload form.
> I think the temp filename is in the $_FILES array too, do a
> print_r($_FILES) to check.
>
>
>> Now, here's the strange bit, if I call my method and just use
>> move_uploaded_file() then the image is saved correctly, so I know
>> it's not the permissions, could someone have a little look at my
>> method and let me know if there's anything wrong with it please
>>

>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

Reply With Quote
  #2 (permalink)  
Old 12-01-2003
Eugene Lee
 
Posts: n/a
Default Re: [PHP] file uploads

On Mon, Dec 01, 2003 at 02:00:34PM +0000, Jon Bennett wrote:
:
: Hi Chris,
:
: I think you're referring to this:
:
: $_FILES["image"]["tmp_name"]
:
: In my class I pass this as a reference:
:
: $aArgs['Image'] = $_FILES["image"];
:
: Then, $aImage in my storeBigImage() method is passed the
: $aArgs['Image'] when it's called:
:
: $this->storeBigImage($productID, $aArgs['Image']);
:
: All the image details are there because otherwise functions like
: getimagesize would fail, it just won't save the resized or, if the
: dimensions of the uploaded image aren't bigger than my max width and
: height, original image, and I really have no idea why!!

In your storeBigImage() method, what do you get if you do:

print_r($aArgs);
Reply With Quote
  #3 (permalink)  
Old 12-01-2003
Jon Bennett
 
Posts: n/a
Default Re: [PHP] file uploads

Ok, I've got it sorted now, but I'm buggered as to why this didn't work
the way I hoped. It seems that if I use an indexed or associative array
to store the location and new image file name, imagejpeg never works,
but if I use a normal var it does !! what's with that!

// doesn't work
$aNewImage['image_loc'] = $aNewImage['image_dir'] .
$aNewImage['new_name'];

// does work!!
$sImageLoc = '/Library/Webserver/Documents/wrox_site/_img/_products/' .
$aNewImage['new_name'];

Why oh why is that the case ??? Would love to know.

Thanks,

Jon


jon bennett | jon@jben.net
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

J b e n . n e t

91 Gloucester Rd, Trowbridge, Wilts, BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/


On 1 Dec 2003, at 14:00, Jon Bennett wrote:

> Hi Chris,
>
> I think you're referring to this:
>
> $_FILES["image"]["tmp_name"]
>
> In my class I pass this as a reference:
>
> $aArgs['Image'] = $_FILES["image"];
>
> Then, $aImage in my storeBigImage() method is passed the
> $aArgs['Image'] when it's called:
>
> $this->storeBigImage($productID, $aArgs['Image']);
>
> All the image details are there because otherwise functions like
> getimagesize would fail, it just won't save the resized or, if the
> dimensions of the uploaded image aren't bigger than my max width and
> height, original image, and I really have no idea why!!
>
> Thanks,
>
> Jon
>
>
> jon bennett | jon@jben.net
> new media designer / developer
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
>
> J b e n . n e t
>
> 91 Gloucester Rd, Trowbridge, Wilts, BA14 0AD
> t: +44 (0) 1225 341039 w: http://www.jben.net/
>
>
>
> On 1 Dec 2003, at 13:36, Chris Hayes wrote:
>
>> PHP first gives the file a temporary name on a temporary location.
>> This name is not the same as the name given in the upload form.
>> I think the temp filename is in the $_FILES array too, do a
>> print_r($_FILES) to check.
>>
>>
>>> Now, here's the strange bit, if I call my method and just use
>>> move_uploaded_file() then the image is saved correctly, so I know
>>> it's not the permissions, could someone have a little look at my
>>> method and let me know if there's anything wrong with it please
>>>

>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>

>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 08:43 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0