HttpPostedFile

G

Guest

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
(e-mail address removed)
 
K

Kevin Spencer

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.
 
T

Torulf

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
 
R

Randy Rahbar

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
 
K

Kevin Spencer

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top