"Neil M" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I am using php to upload image files. > > heres my code .. > > <? > if (is_uploaded_file($photo_file)) > { > > clearstatcache (); > $size = filesize ( $photo_file ) ; > if ( $size > 1024000 ) > { > print ("<BR> ERROR - File is too big ! File uploads should be below 1024 k > ( 1mb ) <BR>"); exit ; > } > move_uploaded_file($photo_file, "$upload_path$check_nick->nickname"); > } > else > { > echo "<BR> ERROR : File upload was not successfull , please try again > !<BR>"; > } > ?> > > ------ > > the problem is that when i look for the original filename ( e.g. > myphoto.gif ) , $photo_file contains a random file name like 383hr93php > > As i mentioned , its image files i am uploading , how do i know what type of > image the file was ? like .jpg , .png etc. > > Any help appreciatted , i am really stuck on this ;0) > > Thanks > > Neil M >
$photo_file will map to the name of the temporary file on the server's HD -- it is NOT the name of the original file. You'll want to use $photo_file_name to determine the original filename, or better yet, $photo_file_type to determine the content type. (a gif is image/gif, for instance). See http://www.php.net/manual/en/features.file-upload.php -- Daniel Grace echo make_witty_sig($foo) . "\n"; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]