Re: Cannot upload JPEG only

From: Date: Thu, 04 Apr 2002 03:38:53 +0000
Subject: Re: Cannot upload JPEG only
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-91475@lists.php.net to get a copy of this message
Thank you for the code snippets. Unfortunately the problem is that I can'tget far enough to process the file. When the php script that supposed to process the file tests with is_uploaded_file, it fails. In addtion, the $HTTP_POST_FILE['userfile']['tmp_name']=none. So i can't process anything since, as far as php is concerned, it appears nothing is uploaded. Carl On Wed, 3 Apr 2002, Bob wrote: > Uhh, yeah, I forgot the getImage function part of the file.. Sorry about > that.. Here it is.. > > function getImage( $image, $newName = false ) > { > global ${ $image }, ${ $image . "_name" }, ${ $image . "_size" }, ${ > $image . "_type" }; > > //check for productImages directory > if( !is_dir( "productImages" ) ) > { > if( !mkdir( "productImages", 0777 ) ) die( "<b>Error:</b> > Could not > create productImages directory." ); > } > > $name = basename( ${ $image . "_name" } ); > $size = ${ $image . "_size" }; > $type = ${ $image . "_type" }; > > $name = strtolower( $name ); > $name = str_replace( " ", "_", $name ); > //$name = ereg_replace( "[\@\$\%\^\~\ \.\,\"\'\(\)\&\*]", > "", $name ); > > if( $newName ) > { > if( eregi( "\.jpg", $name ) or eregi( "\.jpeg", $name ) ) $ext = > ".jpg"; > else $ext = ".gif"; > $name = $newName . $ext; > } > > @copy( ${ $image }, "productImages/$name" ); > return $name; > } > > > Let me know if any of this helps.. > > Bob >

« previous php.general (#91475) next »