Access is Denied error when uploading a file

When developing this file-upload form, I did not run into this problem. I was able to upload files no problem. When I wanted to change the looks and feel of the input file section, I begain recieving this error. Here are the pieces that I am more concern about:

function fileButtonClick()
     document.fileupload.fakefile.value = document.fileupload.file.value;

--in the HTML section--
<form name="fileupload" enctype="multipart/form-data" action="process.asp" method="post" id="fileupload">

<input class="inputReadOnlyFields" type="text" name="fakefile" id="fakefile" />
<span id="browseButton" class="textAsLinks" onclick="fileButtonClick()">Browse</span>
<input type="file" name="file" id="file" style="visibility:hidden" />

For debugging purposes, I put two types of submitting items:

<span id="submitButton" class="textAsLinks" onclick="document.fileupload.submit()">Submit</span>
<button type="submit">Submit</button>


These two react differently (that is why I'm bringing it up). The first one (text) return the access is denied error. The other (the button) just clears out the text in the file field, but does nothing to the fakefile text. If I hit the submit button again, right afterwards, the form is submitted but with no file.

If anyone could help, it would be greatly appreciated!

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.

The File tag has security properties e.g you can't set the value for obvious reasons, this is probably why you're getting an error and why it wont let you submit the value.   Otherwise any site I visit could pull files from my pc without my knowing
In fact not Probably but it Is the reason.  You have to use the File tag properly with its own browse button.

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
vableAuthor Commented:
I completely agree with your reasoning; however, the server is not assigning a string of a file, the client is. In other words, I when the user clicks on the browse link it activates the browse button of the input tag. Therefore, the input tag is retrieving a string from it (the browse button). I am not reassigning the value of the file tag otherwise I would expect a security error.
PMI ACP® Project Management

Prepare for the PMI Agile Certified Practitioner (PMI-ACP)® exam, which formally recognizes your knowledge of agile principles and your skill with agile techniques.

The browser must be seeing it as an attempt to hack the File tag and hence is not allowing it.
vableAuthor Commented:
Doing some more debuggin, I found out that the browser does not have a problem with the document.fileupload.fakefile.value = document.fileupload.file.value; piece but rather fact that I am executing the click function of the file tag from javascript. The browser probably thinks that I am "hacking" the user by doing this. If only I can find another way invoking that method.
vableAuthor Commented:
Researching this topic some more, I found out that the only way to have the file tag work properly is the user must click on the Browse button, and not any other way (e.g. using javascript to invoke the click method of the file tag). Also, I cannot format the style of how this tag look (at least not yet), which was my initial content. So, for the question I asked, there is no answer that anyone could give me that would work for this method of formatting or invoking the file tag. However, GaryC123 did give me some information that does explain why I am receiving the error that I have mention.

Well in my second comment I did say you have to use the File tag with its own Browse button.
vableAuthor Commented:
Yes, I realize that. That is why I accepted that comment as the answer.
vableAuthor Commented:

If GaryC123 is complaining about my grade that I have awarded him, fine, I will change it. However, "askers" should have more than 3 options when it comes to grading. Perhaps a number scale of 1 to 100 would be more efficient. Perhaps the webmaster(s) should also put experts' average next to their names; this will tell other people valuable information such as:

What do other people think of this person?
Should I trust this person and spend time doing what he/she suggests?
When grading this person, what kind of grade should I give that will not negatively affect her/his current average?

The reason why I gave this grade was because I did not receive an answer that I was looking for. Perhaps the answer is not the easiest answer; however, to me, it would better than to just "deal with it"

Just send me to the right page to adjust the grade and I will.

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

From novice to tech pro — start learning today.