Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

file not found, but I know it's there

Status
Not open for further replies.

drew10

Programmer
Feb 26, 2002
123
US
I have a file upload page that uploads an image file, resizes it, and saves it.

The error is thrown on this line.

dim myImage as Image = Image.FromFile(File1.PostedFile.FileName)

It shows system.io.filenotfoundexception when it hits that line. If I use the quickwatch window, and copy the value for file1.postedFile.FileName and paste it into the browser, it shows the image.

I know the file exists. Does anyone know what might be causing this?
Thanks,
Drew10
 
Have you checked the ASPNET user permissions on the directory? You probably don't have 'list folder contents' permissions on that directory or in one of the path (parent) directories.

Hope this helps, NetAngel
 
NetAngel,
You were right. My permissions on the folder I was trying to read the file from did not allow me to access the file. This raises another question for me. If I release the web application, will users experience this problem when they try to upload an image?
Thanks again,
drew10
 
Yes, they sure will.

I always reserve a directory for uploads on my apps where I give ASPNET the necessary permissions to upload files. And those permissions are only on THAT folder. This way the code is safe.

I usually use that folder for uploads and file downloads from the database.
NetAngel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top