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 ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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 > |
|
|||
|
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); |
|
|||
|
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 > |