You are here: Upload works in FF, fails in IE...help? « All PHP « IT news, forums, messages
Upload works in FF, fails in IE...help?

Posted by cadman@wits.end on 07/10/07 20:23

Rather new to php, thought I had made great progress...but...

My simple (so I thought) little $HTTP_POST_FILES item for uploading
..jpgs (to a Unix/Apache server) worked GREAT in FireFox (my browser of
choice) - but then trying it in IE it just flat out fails; doesn't
upload the file, nor will it echo any error messages, so I can't even
begin to try to chase this down. It's drivin' me nuts...ANY help
appreciated, TIA & etc.

Here's what I'm workin' with:

<?

//print_r($_POST);

if($_POST["action"] == "Upload Image")
{
unset($imagename);

if(!isset($_FILES) && isset($HTTP_POST_FILES))
$_FILES = $HTTP_POST_FILES;

if(!isset($_FILES['image_file']))
$error["image_file"] = "An image was not found.";


$imagename = basename($_FILES['image_file']['name']);
//echo $imagename;

if(empty($imagename))
$error["imagename"] = "The name of the image was not found.";

if(empty($error))
{
$newimage = "images/" . $imagename;
//echo $newimage;
$result = @move_uploaded_file($_FILES['image_file']['tmp_name'], $newimage);
if(empty($result))
$error["result"] = "There was an error moving the uploaded file.";
}

}


?>
<h2 style="color:#000033">Add Photo</h2>
<hr>

<form method="POST" enctype="multipart/form-data"
name="image_upload_form" action="<?$_SERVER["PHP_SELF"];?>">
<table border="0" cellpadding="0" cellspacing="0"
style="border-collapse: collapse">
<tr>
<td align="right"><B>Select Picture:&nbsp;</B></td>
<td width="100"><input type="file" name="image_file" size="80"></td>
</tr>
</table>
<p><input type="image" src="upload_off.gif"
onmouseover="this.src='upload_on.gif'"
onmouseout="this.src='upload_off.gif'" value="Upload Image"
name="action"></p>
</form>

<?
echo $imagename;
if(is_array($error))
{
while(list($key, $val) = each($error))
{
echo $val;
echo "<br>\n";
}
}
?>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация