Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Access Denied in IE 6 using HTTPS and File Upload

Posted on 2004-11-30
9
Medium Priority
?
1,122 Views
Last Modified: 2012-05-05
Hello,

I'm hoping someone can help me here. I've got a form that when placed on a server running HTTPS, I get an "access denied" error in IE 6 (non-SP2 and SP-2) when a user tries to upload an image using a file upload form control.

I read something about the onClick() event handler causing it, but I've yet to see a fix or workaround for this. I've posted the form and JavaScript below.

Thanks for any help anyone can provide,

-DA

<form name="myForm" enctype="multipart/form-data"
    action="index.cfm?Action=PhotoUpload" method="post">
    <label for="taDescription">Description:</label>
    <br />
    <textarea id="taDescription" name="description"></textarea>
    <p />
    <label for="fuFile">Photo to upload:</label>
    <br />
    <input id="fuFile" name="upFile" type="file" />
    <br />
    <input type="button" value="Send Now" onClick="submitForm()" />
</form>

<script language="JavaScript">
<!--
function submitForm()
{
    if (!document.myForm.upFile.value.length)
    {
        alert("Please select a file to upload.");
        return false;
        }
    if (!document.myForm.description.value.length)
    {
        alert("Description is required for accessibility.");
        return false;
        }
    document.myForm.submit();
}
// -->
</script>
0
Comment
Question by:Dain_Anderson
9 Comments
 
LVL 31

Expert Comment

by:GwynforWeb
ID: 12706351
youvan get rid of th onclick with changing th eSen Now button to

<input type="submit" value="Send Now"/>
0
 
LVL 5

Expert Comment

by:jpontani
ID: 12706387
If you do the above method you would need to add

onsubmit="submitForm()"

to the <form> element.

- Joe
0
 
LVL 63

Accepted Solution

by:
Zvonko earned 2000 total points
ID: 12706424
I see no error on your page, but I would rewrite it to this:


<form name="myForm" enctype="multipart/form-data"
    action="index.cfm?Action=PhotoUpload" method="post" onSubmit="return checkForm(this)">
    <label for="taDescription">Description:</label>
    <br />
    <textarea id="taDescription" name="description" rows="3" cols="50" ></textarea>
    <p />
    <label for="fuFile">Photo to upload:</label>
    <br />
    <input id="fuFile" name="upFile" type="file" size="40" />
    <br />
    <input type="submit" value="Send Now" />
</form>

<script language="JavaScript">
<!--
function checkForm(theForm){
    if (theForm.upFile.value.length==""){
        alert("Please select a file to upload.");
        theForm.upFile.focus();
        return false;
    }
    if (theForm.description.value==""){
        alert("Description is required for accessibility.");
        theForm.description.focus();
        return false;
    }
    return true;
}
// -->
</script>


0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 9

Author Comment

by:Dain_Anderson
ID: 12707097
Thank you very much -- worked like a charm.

One additional note, one of which I failed to note, is that we also had the following code which was causing issues:

window.onload = function() {
      document.myForm.upFile.click();
}

This would open the file upload dialog window upon entering the page, but upon submitting the form, it would seem to "clear" out the contents of the file upload form control, forcing the user to re-select the image to upload. We just decided to remove this, since I'm not sure how to prevent that from happening.

Thanks again,

-Dain
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 12707926
Thanks for points.
I have heard before of that file control click simulation problem.
Perhaps it would help to do the click like this:

<input id="fuFile" name="upFile" type="file" size="40" />
<script>setTimeout("document.myForm.upFile.click();", 100)</script>

0
 
LVL 9

Author Comment

by:Dain_Anderson
ID: 12708019
Great idea -- I'll give it a try.

Thanks,

-Dain
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 12708150
Perhaps great idea, but I am not sure wether it works.
As far as I can remember does the IE browser on MAC not allow to trigger the file control object, because of security issues.
0
 
LVL 9

Author Comment

by:Dain_Anderson
ID: 12709188
Not sure, but I know it doesn't seem to work in FireFox. I have an iBook here as well that I could test it with if you want to know, but I think it's kind of a bad idea anyway (I wasn't the original coder for the page) since it seems kind of annoying for the user.
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 12709233
No it is not necessary (I need not to know everything :)  but thanks for the offer.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question