473,743 Members | 2,247 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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('upl oad()', 1000); is
called and the next form will be processed. all form's have an
target="uploadd iv", 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.getEle mentById('frmUp load_'+uploads[0]);
if (form["filename"].value == ""){
alert("Please Choose a file to upload.");
} else {
filename = form["filename"].value;
if (filename.lastI ndexOf("\\")>0) {
filename = filename.substr ing(filename.la stIndexOf("\\")
+1,filename.len gth);
} else if (filename.lastI ndexOf("/")>0) {
filename = filename.substr ing(filename.la stIndexOf("/")
+1,filename.len gth);
}
makeRequest("up load_progress.p hp?sid="+sid
+"&filename="+f ilename,progres s);
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 19880
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.c om/freestuff/ajax_file_uploa der/. 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
20077
by: Senthil | last post by:
Hi all I'm new in ajax. How to upload a image using ajax..
5
7705
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 receive the following error: Firefox FireBug Error uncaught exception: Permission denied to get property HTMLDocument.getSelection IE7 Error
3
3928
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 upload files out there, and the file size is only 1 kb. I couldn't get it to work for me. I downloaded the files to my computer, and opened the index file with my browser. It doesn't work (the demo on their site does); IE doesn't show any error...
3
4512
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 my objective is this that when i uplod a file it should be desply on same page with ajax uplod after when i refresh page this should be not remains longer and on clicking other image its replase previous image plz help how i can do this the...
1
3953
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 my objective is this that when i uplod a file it should be desply on same page with ajax uplod after when i refresh page this should be not remains longer and on clicking other image its replase previous image plz help how i can do this the...
3
19052
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 on my webpage. I get back that my readyState is 4 and my status is 200 and status text is "OK", but my responseText is always empty. Both on FireFox and IE7, so it must be something I'm doing (wrong). I've also set up an IFRAME to redirect the...
1
3191
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 seen so far that did not resolve my problem... Environment and problem: I have a page A with Ajax.js and a <div id="ajx">Content</div> that changes when clicking on a link. Another page, page B, gets loaded into page A and (tries) to load a...
11
8409
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 send a JSON-encoded request to a remote web service. The stumbling block I'm running into is that one of the inputs in the form is a file upload element, and I can't figure out how to include the data from the specified file in the JSON...
1
6511
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 iframeID.contentWindow.document for MSIE). This results in an 'access denied' issue in MSIE (No problem in Mozilla). Note that if there is document.domain initialization before this iframe creation/content injection, there is no problem and all works well.
0
8795
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9486
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9277
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8218
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6057
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4572
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4827
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3286
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2759
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.