HttpPostedFile

  • Thread starter Thread starter Guest
  • Start date Start date
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)
 
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.
 
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
 
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
 
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.
 
Back
Top