When Asp.net uploads a file and uses the file control of the HTML control, the following error occurs: [system. Io. filenotfoundexception: the file cannot be found]. This is why the full path name cannot be obtained during file upload.
When a file is uploaded using a file stream to obtain the absolute path of the File Uploaded by the client, an error is reported sometimes because the security settings are different in different browsers.
In IE7/8/FF/GG, the uploaded file does not display the full path, GG and FF only display the file name, and IE8 displays c: \ fakepath \ test.txt ". This is because of browser security settings.
Solution:
Open IE browser --> Internet Options --> Security --> Custom Level --> others --> enable "show file directory path when uploading files to the server"
Click OK and then run again.
Another solution:
If the error message is about the file size you readCode, That is the same as what I met, the following code:
Httpfilecollection _ FILES = system. Web. httpcontext. Current. Request. files;
String name = _ FILES [I]. filename;
Fileinfo Fi = new fileinfo (name );
Then: fi. length gets the file size to determine the upload size limit.
In this case, an error is reported, that is, the path problem mentioned above.
In this case, convert the file size to _ FILES [I]. contentlength, and then OK.