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

problem with IE and (ajax) file upload via iframe: javascript error access denied/zugriff verweigert

P: n/a
i want to do (multiple) file upload(s) and display a progress bar.
with firefox and safari it is no problem at all. only IE makes some
problems.

my script is based on ajax-uploader, which can be found at
www.srmiles.com/freestuff/ajax_file_uploader/ . you can do multiple
file uploads. each upload will have it's own "form"-tag, so that each
file is uploaded for its own. could be a good solution if there are
"big" uploads.

so here is what i do:

i have a html-page in which several forms with file-input fields are
generated. when i now hit the "one" submit button at the bottom of the
page a javascript function upload() starts it will iterate through all
forms (id='frmUpload_xx'), will get the filename, start a ajax request
for the progress-bar function and do a form.submit().

if the first form/file is uploaded, a settimeout('upload()', 1000); is
called and the next form will be processed. all form's have an
target="uploaddiv", where uploaddiv is a invisible iframe. so the
output of the upload script is put in this div. output should only be
a "OK" at the end. no usefull output no info no nothing.

firefox and safari are working as expected, only IE stops after the
first file is uploaded. i get an javascript error saying "zugriff
verweigert/access denied" on object line x... this is the place where
i call "form.submit()".

this is the upload-function:

function upload() {
if (uploads.length>0) {
form = document.getElementById('frmUpload_'+uploads[0]);
if (form["filename"].value == ""){
alert("Please Choose a file to upload.");
} else {
filename = form["filename"].value;
if (filename.lastIndexOf("\\")>0) {
filename = filename.substring(filename.lastIndexOf("\\")
+1,filename.length);
} else if (filename.lastIndexOf("/")>0) {
filename = filename.substring(filename.lastIndexOf("/")
+1,filename.length);
}
makeRequest("upload_progress.php?sid="+sid
+"&filename="+filename,progress);
form.submit();
}
}
}

the strange thing is, that filename is filled correct, that means the
object "form" is found and exisits. the first iteration is working,
only the second ends with an error.

think it have something to do with redirecting the output of the
upload-script in an iframe. after that IE can't access form - at least
IE is not allowed to submit the form as i can access a form field
(filename).
i worked on that the last two days and haven't found a solution...

thanxs for any help

markus

Feb 14 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
VK
On Feb 14, 7:31 pm, markus.rietz...@rzf.fin-nrw.de wrote:
i want to do (multiple) file upload(s) and display a progress bar.
with firefox and safari it is no problem at all. only IE makes some
problems.

my script is based on ajax-uploader, which can be found atwww.srmiles.com/freestuff/ajax_file_uploader/. you can do multiple
file uploads. each upload will have it's own "form"-tag, so that each
file is uploaded for its own. could be a good solution if there are
"big" uploads.

so here is what i do:

i have a html-page in which several forms with file-input fields are
generated. when i now hit the "one" submit button at the bottom of the
page a javascript function upload() starts it will iterate through all
forms (id='frmUpload_xx'), will get the filename, start a ajax request
for the progress-bar function and do a form.submit().
I can be very wrong, but you may be hitting the open connections limit
on IE. By default IE allows only 2 open connections at ony time
segment. Because there is no way to have a progress bar for upload
over CGI, you must be hacking it over Comet-like solution with extra
server-side upload tracker. Any Comet-like hack enforces one channel
to stay open so it breaks the default queueing mechanics. At some time
it may happen that you require to open 3rd channel with 2 already
enforced to stay open - and here IE revoltes. You may check my
speculation by tweaking the Windows registry so allow IE to have say
10 open channels at once and see it it helps. That can be your free IE
usage license violation, but only temporarily and in the name of pure
science...
Feb 14 '07 #2

P: n/a
I can be very wrong, but you may be hitting the open connections limit
on IE. By default IE allows only 2 open connections at ony time
segment.
no this is not a problem. what i don't quite understand yet: as writen
i have to forms on the page, each identified via "ID"-attribut. so,
the first upload works in IE without any problems. only the second
upload will lead to the error.

and here comes the strange thing: i test if filename is set. if so i
start the upload if not i will jump to the next form. so, when i add
to upload fields (means having to forms on the page) and only choose a
file in the second form. and then i hit "submit", the empty filename-
field is detected and that form is ignored. i call the upload-function
for the second time. and then IE can't access form.submit (access/
permission denied). so at this point no ajax call, no other form-
submit, no other window/target no nothing happend. what is the problem
here? i can access each field in this form but i can't call
form.submit()?????

Feb 15 '07 #3

P: n/a
On Feb 15, 8:31 am, markus.rietz...@rzf.fin-nrw.de wrote:
I can be very wrong, but you may be hitting the open connections limit
on IE. By default IE allows only 2 open connections at ony time
segment.

no this is not a problem. what i don't quite understand yet: as writen
i have to forms on the page, each identified via "ID"-attribut. so,
the first upload works in IE without any problems. only the second
upload will lead to the error.

and here comes the strange thing: i test if filename is set. if so i
start the upload if not i will jump to the next form. so, when i add
to upload fields (means having to forms on the page) and only choose a
file in the second form. and then i hit "submit", the empty filename-
field is detected and that form is ignored. i call the upload-function
for the second time. and then IE can't access form.submit (access/
permission denied). so at this point no ajax call, no other form-
submit, no other window/target no nothing happend. what is the problem
here? i can access each field in this form but i can't call
form.submit()?????
That's right, avoid form.submit() if you can. (And 99% of the time,
you can.) IE (especially IE7) takes a lot of extra security
precautions when a script in one frame tries to invoke certain actions
(such as form submission) in another frame. Instead, have the user
click a "submit" button and cancel (if necessary) using an "onsubmit"
handler attached to the form, instead of validating and then
submitting.

Although browsers can be difficult, there are many ways to get the job
done. If your first approach doesn't work there are probably several
others that will.

-David

Feb 15 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.