'Foo', '200' => 'Bar', '300' => 'Toast', '400' => 'Other' ); $offset = 5; $max_image_width = '550'; $max_image_height = '600'; $max_upload_bytes = '100000'; require_once('dbconn.php'); $self = basename($_SERVER['PHP_SELF']); ?>
Images for Shopping Cart (inventory1)
Results ...'; echo "\n".'';
if($submit == 'Upload Image'){
if($id == 'new_item'){
if($item_name == ''){
$errors[] = 'No Item name was entered';
}
}
if(file_exists($file_tmp) && list($image_width, $image_height, $image_type1, $img_attrib) = getimagesize($file_tmp) ){
if($image_width > $max_image_width){
$errors[] = 'The image width exceeds the allowed width of '.$max_image_width. ' pixels by '.($image_width-$max_image_width).' pixels';
}
if($image_height > $max_image_height){
$errors[] = 'The image height exceeds the allowed height of '.$max_image_height. ' pixels by '.($image_height-$max_image_height).' pixels';
}
if(!$data = addslashes(fread(fopen($file_tmp, "r"), filesize($file_tmp)))){
$errors[] = 'Unable to read file';
}
if(filesize($file_tmp) > $max_upload_bytes){
$errors[] = 'Image exceeds maximum file size of '.number_format($max_upload_bytes);
}
}else{
$errors[] = 'Unable to locate '.$file_tmp;
}
if(count($errors) > 0){
echo "\n".'
|
Query failed.
Query: '.$qry.'
'.mysql_error().'
'.$insert_id.' image uploaded
'; echo "\n".'Query failed.
Query: '.$qry.'
'.mysql_error().'
'.mysql_error().'
' : ''; }else{ echo "\n".''.$success.'
'; echo "\n".'If no image appears,
then the upload failed.