Jump to content

Upload files working with Firefox but with IE don’t


web_master

Recommended Posts

hi,

 

I have a script for upload and resize a files (photos). Its workinf fine, upload the files BUT with IE can’t work. Can anyobody tell me why?

 

<?php
$temporary_name = $_SERVER['DOCUMENT_ROOT']."/up_gallery/temp_".$tt_photo_id."_02.jpg";
move_uploaded_file($_FILES['gallery_photo']['tmp_name'][2], $temporary_name);

$mimetype = $_FILES['gallery_photo']['type'][2];
$filesize = $_FILES['gallery_photo']['size'][2];

//Open the image using the imagecreatefrom..() command based on the MIME type.
switch($mimetype) {
case "image/jpg":
case "image/jpeg":
	$i = imagecreatefromjpeg($temporary_name);
	break;
case "image/gif":
	$i = imagecreatefromgif($temporary_name);
	break;
case "image/png":
	$i = imagecreatefrompng($temporary_name);
	break;
}

//Delete the uploaded file
unlink($temporary_name);

//Save a copy of the original
imagejpeg($i, $_SERVER['DOCUMENT_ROOT']."/up_gallery/_photo_".$tt_photo_id."_02.jpg",80);


//Specify the size of the thumbnail
$dest_x = 460;
$dest_y = 345;

//Is the original bigger than the thumbnail dimensions?
if (imagesx($i) > $dest_x or imagesy($i) > $dest_y) {

//Is the width of the original bigger than the height?
if (imagesx($i) >= imagesy($i)) {
$thumb_x = $dest_x;
$thumb_y = imagesy($i)*($dest_x/imagesx($i));
} else {
$thumb_x = imagesx($i)*($dest_y/imagesy($i));
$thumb_y = $dest_y;
}
} else {
//Using the original dimensions
$thumb_x = imagesx($i);
$thumb_y = imagesy($i);
}

//Generate a new image at the size of the thumbnail
$thumb = imagecreatetruecolor($thumb_x,$thumb_y);

//Copy the original image data to it using resampling
imagecopyresampled($thumb, $i ,0, 0, 0, 0, $thumb_x, $thumb_y, imagesx($i), imagesy($i));

//Save the picture
imagejpeg($thumb, $_SERVER['DOCUMENT_ROOT']."/up_gallery/photo_".$tt_photo_id."_02.jpg", 80);


unlink($_SERVER['DOCUMENT_ROOT']."/up_gallery/_photo_".$tt_photo_id."_02.jpg");
?>

 

thnx in advanced!

Link to comment
Share on other sites

Can you post the code for the upload form please

 

 

<?php
$tt_photo_id = $_REQUEST['tt_photo_id'];


if($_REQUEST['reload'] == 2) {

// Insert Into
$query_return = mysql_query("INSERT INTO `tt_photo` (
`tt_photo_album`
)
VALUES (
'".$_POST['tt_photo_album']."'
)");

if(!$query_return) {
	echo mysql_error();
	exit;
}

$tt_photo_id = mysql_insert_id();




// Query_return
$query_return = mysql_query("SELECT * FROM `tt_photo` WHERE `tt_photo_id` = '".$tt_photo_id."'");

if(!$query_return) {
	echo mysql_error();
	exit;
}

$request = mysql_fetch_array($query_return);

//Upload photo #1
if($_FILES['gallery_photo']['name'][1]) {
	include("photo_resizer_file.php"); //this is the photo resizer file
}

//View picture 1
$gallery_photo_1 = "../up_gallery/photo_thumb_".$request['tt_photo_id']."_01.jpg";
	if(is_file($gallery_photo_1)) {
		$gallery_photo_1_print = "<img src=\"".$gallery_photo_1."\" alt=\"\" border=\"0\">";
	} else {
		$gallery_photo_1_print = " ";
	}
?>


<form name="photo_form" action="<?php print $_SERVER['PHP_SELF'];?>" method="post" enctype="multipart/form-data">
<input type="file" name="gallery_photo[1]" size="30" class="MAINPH_RIGHT_FORM">
<input type="submit" name="tt_photo_submit" value="UPLOAD" class="SUBMIT_BUTTON_GREEN_BLACK_TXT">
<input type="hidden" name="reload" value="<?php print $_REQUEST['reload'];?>">
<input type="hidden" name="tt_photo_id" value="<?php print $request['tt_photo_id'];?>">
</form>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.