Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Access is Denied error when uploading a file

Posted on 2003-10-29
Last Modified: 2012-05-04
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!

Question by:vable
  • 5
  • 4
LVL 58

Expert Comment

ID: 9647864
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
LVL 58

Accepted Solution

Gary earned 500 total points
ID: 9647867
In fact not Probably but it Is the reason.  You have to use the File tag properly with its own browse button.

Author Comment

ID: 9650699
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.
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

LVL 58

Expert Comment

ID: 9651320
The browser must be seeing it as an attempt to hack the File tag and hence is not allowing it.

Author Comment

ID: 9654441
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.

Author Comment

ID: 9658389
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.

LVL 58

Expert Comment

ID: 9658422
Well in my second comment I did say you have to use the File tag with its own Browse button.

Author Comment

ID: 9660036
Yes, I realize that. That is why I accepted that comment as the answer.

Author Comment

ID: 9660865

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.


Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Select distinct 25 116
Classic ASP application Will support SQL 2014 5 94
Help with query 3 31
Reg Exp to extract Url from string asp 12 15
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

838 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