By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,711 Members | 2,130 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,711 IT Pros & Developers. It's quick & easy.

How to make file uploading work in Internet Explorer?

P: 1

I have wrote code that uploads files from user's hard disks to the server and everything works fine in Firefox and Safari, but in Internet Explorer it uploads dummy files and cycles that. So when I try to upload one photo, I get a lot of dummy files on my server and a lot of record in MySQL insted of one record.

I guess the problem in JS:


imageWait = new Image(); imageWait.src = "";

function showWaitImage() {
document.getElementById('photoSubmit').disabled = true;
document.getElementById('photoSubmit').value='Зака чивается...';
var showMap = document.getElementById("showMap");
showMap.innerHTML = '<iframe src="" frameBorder=0 scrolling=no></iframe>';
var mapThisPhoto = document.getElementById("mapThisPhoto");
mapThisPhoto.innerHTML = '<span></span>';

var div = document.getElementById("image");
div.innerHTML = '<table width="100%" cellspacing="0" cellpadding="0"><tr><td align="center"><span class="style">Фотография закачивается, пожалуйста подождите...<br /><br />&nbsp;<br />&nbsp;<br /><img src="" id="myImage" /></span></td></tr></table>';
document.getElementById("myImage").onload = function() {
return false;


The form looks like it's ok:
[PHP]<form name="photoForm" id="photoForm" action="uploadsub.php?geo=3017382&dest=&typet=ph&l ang=ru" method="post" enctype="multipart/form-data"><input type="hidden" name="MAX_FILE_SIZE" value="4000000" /><input size="15" name="url" type="file" style="border:1px solid #777777" class="style">
<input value="Закачать" type="submit" class="style" name="photoSubmit" id="photoSubmit" onclick="return showWaitImage()"></form>[/PHP]

In ShowWaitImage() function everthing works until this:
[PHP]document.getElementById("myImage").onload = function() {

I wonder what part of code doesn't work in IE? Why that happens?

PS: Live example is here (login "test", pass "thetest"):
Jan 5 '08 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 15k+
P: 16,027
It may have something to do with how IE loads images. Why are you submitting the form on image load?
Jan 7 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.