I'm trying to upload files on the server (running IIS) using <input type=file name=myfile> in my ASP.net application (.net 2003).
It works fine on local system but when I try this on the server it uploads only small files of size max 50Kb.Attempts to upload larger file end up with an error saying :
Could not find a part of the path "C:\Inetpub\wwwroot\myweb\Academic\". source : mscorlib
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 sdmsystem.Upload.Page_Load(Object sender, EventArgs e) in C:\Inetpub\wwwroot\myweb\Upload.aspx.vb:line 32 at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain()
I have already made the following changes in my web.config file
<httpRuntime executionTimeout="900" maxRequestLength="20000" /> and given full permissions on the folder to all users.
But could not find a solution.
I'm using the follwing code:
If Request.Files.Count = 1 Then
fName = myFile.PostedFile.FileName
fName = Right(fName, (fName.Length - fName.LastIndexOf("\")) - 1)
Dim FilePath As String
FilePath = Server.MapPath("")& "\Academic\" & fName
myFile.PostedFile.SaveAs(FilePath)
lblMsg.Text = fName
End If
Since the path works fine for smaller files,m sure that there is no problem with the path.Am I missing something ????
|