473,320 Members | 1,695 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

HttpPostedFile

Hi!

It seems the HttpPostedFile object can't save a file to a
destination withing the web's structure. I want to upload
pictures from a page and store them in a subfolder to the
web folder (necessare to be able to show them on other
pages)

I can store the pics anywhere else on the server except
into any directory within the web.

Any ideas?

Torulf
to****@programplatsen.se
Nov 17 '05 #1
4 2907
What exsactly is the problem with saving the files to a directory inside
your web? What error message are you getting? Sounds like a permissions
problem.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Big Things are made up of
Lots of Little Things.

<to****@programplatsen.se> wrote in message
news:0a****************************@phx.gbl...
Hi!

It seems the HttpPostedFile object can't save a file to a
destination withing the web's structure. I want to upload
pictures from a page and store them in a subfolder to the
web folder (necessare to be able to show them on other
pages)

I can store the pics anywhere else on the server except
into any directory within the web.

Any ideas?

Torulf
to****@programplatsen.se

Nov 17 '05 #2
Hi!

I think you are quite rigth! But still I don't know what
permissions I should set to be able to save the file in a
directory under my web dir. Any hints appreciated!

Here is the exception output (rnjFileUploads is where my
web resides):
System.UnauthorizedAccessException: Access to the
path "G:\inetpub\wwwroot\rnjFileUploads\2001-12-25
004.jpg" is denied. at System.IO.__Error.WinIOError(Int32
errorCode, String str) at System.IO.FileStream..ctor
(String path, FileMode mode, FileAccess access, FileShare
share, Int32 bufferSize, Boolean useAsync, String msgPath,
Boolean bFromProxy) at System.IO.FileStream..ctor(String
path, FileMode mode) at System.Web.HttpPostedFile.SaveAs
(String filename) at
rnjFileUploads.nyheter_ny.saveBtn_Click(Object o,
EventArgs e) in
g:\inetpub\wwwroot\rnjfileuploads\nyheter_ny.aspx. cs:line
43

Torulf
-----Original Message-----
What exsactly is the problem with saving the files to a directory insideyour web? What error message are you getting? Sounds like a permissionsproblem.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Big Things are made up of
Lots of Little Things.

<to****@programplatsen.se> wrote in message
news:0a****************************@phx.gbl...
Hi!

It seems the HttpPostedFile object can't save a file to a destination withing the web's structure. I want to upload pictures from a page and store them in a subfolder to the web folder (necessare to be able to show them on other
pages)

I can store the pics anywhere else on the server except
into any directory within the web.

Any ideas?

Torulf
to****@programplatsen.se

.

Nov 17 '05 #3
> System.UnauthorizedAccessException: Access to the
path "G:\inetpub\wwwroot\rnjFileUploads\2001-12-25
004.jpg" is denied. at System.IO.__Error.WinIOError(Int32


I've also received this error trying to do the exact same thing (uploading
images). I changed permissions for the directory to full control for the
aspnet user and still no luck... I'm still looking for a solution to this
problem if anyone can help.

Thanks in advance,

Randy
Nov 17 '05 #4
Sounds like the account under which your ASP.Net worker process is running
doesn't have the necessary file system permission to save the files to the
locations in your web. You could set the proper permission using Windows
Explorer.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Big Things are made up of
Lots of Little Things.

"Torulf" <an*******@discussions.microsoft.com> wrote in message
news:12****************************@phx.gbl...
Hi!

I think you are quite rigth! But still I don't know what
permissions I should set to be able to save the file in a
directory under my web dir. Any hints appreciated!

Here is the exception output (rnjFileUploads is where my
web resides):
System.UnauthorizedAccessException: Access to the
path "G:\inetpub\wwwroot\rnjFileUploads\2001-12-25
004.jpg" is denied. at System.IO.__Error.WinIOError(Int32
errorCode, String str) at System.IO.FileStream..ctor
(String path, FileMode mode, FileAccess access, FileShare
share, Int32 bufferSize, Boolean useAsync, String msgPath,
Boolean bFromProxy) at System.IO.FileStream..ctor(String
path, FileMode mode) at System.Web.HttpPostedFile.SaveAs
(String filename) at
rnjFileUploads.nyheter_ny.saveBtn_Click(Object o,
EventArgs e) in
g:\inetpub\wwwroot\rnjfileuploads\nyheter_ny.aspx. cs:line
43

Torulf
-----Original Message-----
What exsactly is the problem with saving the files to a

directory inside
your web? What error message are you getting? Sounds like

a permissions
problem.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Big Things are made up of
Lots of Little Things.

<to****@programplatsen.se> wrote in message
news:0a****************************@phx.gbl...
Hi!

It seems the HttpPostedFile object can't save a file to a destination withing the web's structure. I want to upload pictures from a page and store them in a subfolder to the web folder (necessare to be able to show them on other
pages)

I can store the pics anywhere else on the server except
into any directory within the web.

Any ideas?

Torulf
to****@programplatsen.se

.

Nov 17 '05 #5

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

Similar topics

1
by: Jeff | last post by:
I am using the HttpPostedFile to allow users to upload files to a server farm. The SaveAs() saves to a shared network path (\\SERVER\SHARE) so that no matter which web server is taking the...
3
by: huan | last post by:
Hi, I am creating a function using C# to send emails with attachment file. And I am using File Field control to get file for attachment. Sending email works fine on development machine, however...
1
by: terrorix | last post by:
I want to save uploaded file to disk. I have this construction: HttpPostedFile myFile = ((HttpRequest)Request).Files; if (myFile != null) { string fn =...
8
by: Al Smith | last post by:
Hi, I am able to use the HttpPostedFile.SaveAs() method to upload and save a file to the local web machine. However, I would really like to save the file to a VirtualDirectory. Does anyone...
2
by: NATO24 | last post by:
Hello, I am trying to write a sub routine that I can pass a posted (image) file to. That routine will save the original file, then create a thumbnail and save it. When I try to create the image...
5
by: MSDN | last post by:
Does anyone know why I am getting Invalid cast exception??? For Each oFile As System.web.HttpPostedFile In Request.Files ....... etc..... Next I Checked that
0
by: Rob Maui | last post by:
I use the following code in an aspx file to read the file name which I am uploading from the client PC onto the server; Dim MyFileName As String Dim MyFileColl As HttpFileCollection =...
1
by: Ralph Watermann | last post by:
Hi, we upload an Excel-file via a FileUpload-Control into an HttpPostedFile object. Now we want to access the contained data directly without saving it to a temp file. Is this possible? So...
4
by: macap.usenet | last post by:
Hello, I´ve a strange problem with my HttpPostedFile object. I coded a File Upload where the user can upload a zip file. My code looks like this: HttpFileCollection files =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.