473,761 Members | 8,813 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Upload error - Access to the path xxx is denied

Hello All,
I'm getting a strange error when trying to perform a file upload. Here's the
lines that uploads the file...

sSaveLocation = Server.MapPath( "PFPDocs") + "\\" + fileName;
fileInput.Poste dFile.SaveAs(sS aveLocation);

When it runs, I'm getting a "Access to the path xxx is denied" error. On the
server (Server 2003) I've given the ASP.NET and Everyone Full Control but
still I get the error. I've also given IUSR_machinenam e Full Control and I
still get the error.
One thing that is strange and I'm not sure if it's a problem, when the error
is reported in the dialog, it states that...
Access to the path "C:Inetpubwwwro otPFPAppPFPDocs MyFile.xls" is denied
In the above error the "\"'s are not in there. I'm not sure if this is the
reason it won't upload the file or if it is a permissions thing.

Thanks
Nov 19 '05 #1
3 4220
If you use C#, you must double the slashes
in order for one of them to show.

Check your fileName code and put double slashes "\\"
wherever you have a single slash "\".

Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
=============== =======

"Randy" <te**@temp.co m> wrote in message news:OY******** ******@TK2MSFTN GP14.phx.gbl...
Hello All,
I'm getting a strange error when trying to perform a file upload. Here's the lines that
uploads the file...

sSaveLocation = Server.MapPath( "PFPDocs") + "\\" + fileName;
fileInput.Poste dFile.SaveAs(sS aveLocation);

When it runs, I'm getting a "Access to the path xxx is denied" error. On the server
(Server 2003) I've given the ASP.NET and Everyone Full Control but still I get the
error. I've also given IUSR_machinenam e Full Control and I still get the error.
One thing that is strange and I'm not sure if it's a problem, when the error is reported
in the dialog, it states that...
Access to the path "C:Inetpubwwwro otPFPAppPFPDocs MyFile.xls" is denied
In the above error the "\"'s are not in there. I'm not sure if this is the reason it
won't upload the file or if it is a permissions thing.

Thanks

Nov 19 '05 #2
Yes, I'm doing that...here's the line from below...
sSaveLocation = Server.MapPath( "PFPDocs") + "\\" + fileName;
But, like I said, the error message doesn't show any slashes in it...strange

"Juan T. Llibre" <no***********@ nowhere.com> wrote in message
news:u1******** *****@TK2MSFTNG P12.phx.gbl...
If you use C#, you must double the slashes
in order for one of them to show.

Check your fileName code and put double slashes "\\"
wherever you have a single slash "\".

Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
=============== =======

"Randy" <te**@temp.co m> wrote in message
news:OY******** ******@TK2MSFTN GP14.phx.gbl...
Hello All,
I'm getting a strange error when trying to perform a file upload. Here's
the lines that uploads the file...

sSaveLocation = Server.MapPath( "PFPDocs") + "\\" + fileName;
fileInput.Poste dFile.SaveAs(sS aveLocation);

When it runs, I'm getting a "Access to the path xxx is denied" error. On
the server (Server 2003) I've given the ASP.NET and Everyone Full Control
but still I get the error. I've also given IUSR_machinenam e Full Control
and I still get the error.
One thing that is strange and I'm not sure if it's a problem, when the
error is reported in the dialog, it states that...
Access to the path "C:Inetpubwwwro otPFPAppPFPDocs MyFile.xls" is denied
In the above error the "\"'s are not in there. I'm not sure if this is
the reason it won't upload the file or if it is a permissions thing.

Thanks


Nov 19 '05 #3
Randy, this works for me:

savePath.aspx
-------------------------------
<%@ Page Language="C#" %>

<script language = "C#" runat="server">
void Page_Load(Objec t Sender, EventArgs e)
{
String fileName = "a.txt";
String sSaveLocation = Server.MapPath( "PFPDocs") + "\\" + fileName;
Label1.Text = sSaveLocation;
}
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Retrievi ng a FilePath</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" Runat="server" Text=""></asp:Label>
</div>
</form>
</body>
</html>

---000---

That returns : C:\Inetpub\wwwr oot\test\PFPDoc s\a.txt

I don't see why it shouldn't work for you.

Try running just that page (savePath.aspx) , and see what it returns.
That should make your sleuthing easier.

Does the directory "wwwroot\PFPApp \PFPDocs" exist ?

Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
=============== =======

"Randy" <te**@temp.co m> wrote in message news:uF******** ******@TK2MSFTN GP15.phx.gbl...
Yes, I'm doing that...here's the line from below...
sSaveLocation = Server.MapPath( "PFPDocs") + "\\" + fileName;
But, like I said, the error message doesn't show any slashes in it...strange

"Juan T. Llibre" <no***********@ nowhere.com> wrote in message
news:u1******** *****@TK2MSFTNG P12.phx.gbl...
If you use C#, you must double the slashes
in order for one of them to show.

Check your fileName code and put double slashes "\\"
wherever you have a single slash "\".

Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
=============== =======

"Randy" <te**@temp.co m> wrote in message news:OY******** ******@TK2MSFTN GP14.phx.gbl...
Hello All,
I'm getting a strange error when trying to perform a file upload. Here's the lines
that uploads the file...

sSaveLocation = Server.MapPath( "PFPDocs") + "\\" + fileName;
fileInput.Poste dFile.SaveAs(sS aveLocation);

When it runs, I'm getting a "Access to the path xxx is denied" error. On the server
(Server 2003) I've given the ASP.NET and Everyone Full Control but still I get the
error. I've also given IUSR_machinenam e Full Control and I still get the error.
One thing that is strange and I'm not sure if it's a problem, when the error is
reported in the dialog, it states that...
Access to the path "C:Inetpubwwwro otPFPAppPFPDocs MyFile.xls" is denied
In the above error the "\"'s are not in there. I'm not sure if this is the reason it
won't upload the file or if it is a permissions thing.

Thanks

Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
11763
by: dave | last post by:
Hello there, I am at my wit's end ! I have used the following script succesfully to upload an image to my web space. But what I really want to be able to do is to update an existing record in a table in MySQL with the path & filename to the image. I have successfully uploaded and performed an update query on the database, but the problem I have is I cannot retain the primary key field in a variable which is then used in a SQL update...
4
14523
by: R Reyes | last post by:
I am trying to code a file uploader (for forum/email attachments) from the client computer to a remote web server via the PUT method (since POST is not allowed ). However, the upload works ONLY when the file is inside a shared folder on my computer. If I try to upload from any other folder it does not work. Why is this? Reason being that whenever I upload files on other forums or websites I know I don't need to have my folder shared...
14
3894
by: Al Smith | last post by:
I need help in implementing proper error handling. I am trying to upload a file based on the sample code below. The code works well except if the file selected is too big. I do know about the maxRequestLength parameter of the <httpRuntime> section and that works as expected. What I want is to enforce a max file size but haven't been able to trap the error thrown when the file is too large and that's where I could use some help.
2
6063
by: Tom Wells | last post by:
I have a little file upload page that I have been able to use to successfully upload files to the C: drive of LocalHost (my machine). I need to be able to upload to a network drive from the intranet server. On the line: dirs = Directory.GetDirectories(currentDir) I get "Access to the path "\\les-net\les\Special Projects\ATSPDF" is denied." How do I get the GetDirectories command to user my user ID and password when it tries to hit the...
1
2819
by: Stefan Berger | last post by:
Hello everybody, i have a proble with uploading files in asp.net. i want to make a special file upload-page without displaying the common html-file-upload-control. i have a made an additional upload-button which shold display the open-file-dialog an then immediatly submit the form. it's no problem to call the open-file-dialog by javascript ( inputfilecontrol.click() ), but if i want to submit the form i get an error 'access denied' and...
9
3836
by: Wayne Smith | last post by:
I've come up against a major headache that I can't seem to find a solution for but I'm sure there must be a workaround and I would really be grateful of any help. I'm currently building a web site for a small club I belong to and one of the features I would like to include is the ability to allow users to upload image files. unfortunately the servers web root www folder only allows READ and EXECUTE permissions, which makes it...
1
3279
by: igotyourdotnet | last post by:
Ok, here is the issue: I have 2 web pages one does a file upload to a database and the other page does a FTP to a server, both pages use the c:\temp directory. The page that uploads to a database works fine, the page that FTP's the files returns me an error (Access denied filename.txt) Now the asp.net ID has full control of the c:\temp directory. The only difference in the 2 pages is that page 2 creates a text file writes data to it then...
7
7624
by: sforsasi | last post by:
Hi, I'm trying a simple code to upload a file to the server. When I click to Upload I get the following error message: Error: Access to the path xxx is denied The folder in which I'm trying to upload the file has all access. I've included NETWORK SERVICE - with full control and ASPNET - with full control to the folder.
6
3759
by: lily86 | last post by:
i'm using vs.net 2003.... i want to let the user upload images and i want to save the image to my web server file to convenient i display the images on other pages.... but i'm having a problem when i try to save the images file to my we b server side.... here is my code : Dim CurrentFileName As String CurrentFileName = FileUpload1.FileName Dim CurrentPath As String = Server.MapPath("~/Img/") If...
0
9554
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
9923
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
9811
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8813
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...
1
7358
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6640
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
5405
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3911
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
3
3509
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.