473,403 Members | 2,293 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

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

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
3 19814
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Senthil | last post by:
Hi all I'm new in ajax. How to upload a image using ajax..
5
by: brad | last post by:
I'll post my code below. My goal is to grab the selected text in an iFrame from javascript (really any way possible). When I highlight text in the iFrame and click the link outside of the iFrame, I...
3
by: dreamznatcher | last post by:
Hello, I found a script here: http://www.webtoolkit.info/ajax-file-upload.html which supposedly allows you to upload files using AJAX (I'm not an expert). The site claims it's the best way to...
3
by: kksandeep | last post by:
i am using this three files to uplod file. i got this file from net but i think these have some error. i am new to this field plz help the script i found is some helpful but not too that i need ...
1
by: kksandeep | last post by:
i am using this three files to uplod file. i got this file from net but i think these have some error. i am new to this field plz help the script i found is some helpful but not too that i need ...
3
by: JMcCrillis | last post by:
I've implemented a FileUpload servlet using AJAX and JS. It appears to be working well but for one issue. I used XMLHTTP so I could intercept the response in Javascript and write it out to a field...
1
by: wenijah | last post by:
Hi everyone! First thank you for reading this post and yes, you probably already see that kind of topic title somewhere but the problem I've got today might be different than the 100 topics I've...
11
by: kj | last post by:
I would like to convert a form that currently uses the traditional CGI sequence (i.e. the action associated with the form sends a POST request to a server-side CGI script) to one that uses AJAX to...
1
by: raviviswanathan.81 | last post by:
Hello, So we have a webmaster who sets document.domain to some domain. After that, we try to create and inject text inside an iframe by getting the iframeID.contentDocument (or...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.