Access Denied in IE 6 using HTTPS and File Upload

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>
LVL 9
Dain_AndersonAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

GwynforWebCommented:
youvan get rid of th onclick with changing th eSen Now button to

<input type="submit" value="Send Now"/>
0
jpontaniCommented:
If you do the above method you would need to add

onsubmit="submitForm()"

to the <form> element.

- Joe
0
ZvonkoSystems architectCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Dain_AndersonAuthor Commented:
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
ZvonkoSystems architectCommented:
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
Dain_AndersonAuthor Commented:
Great idea -- I'll give it a try.

Thanks,

-Dain
0
ZvonkoSystems architectCommented:
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
Dain_AndersonAuthor Commented:
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
ZvonkoSystems architectCommented:
No it is not necessary (I need not to know everything :)  but thanks for the offer.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.