Hi Expert,
I am uploading image file using asp.net FileUpload control.
I am using following code.
try
{
string fileName = Path.GetFileName(FileUpload1.PostedFile.FileName);
string fileExtension = Path.GetExtension(FileUpload1.PostedFile.FileName);
string fileLocation = Server.MapPath("~/images/" + fileName);
FileUpload1.SaveAs(fileLocation);
}
catch(Exception ex)
{
Response.Write(ex.StackTrace.ToString());
}</pre>
Locally it working fine for me.
but on server it
FileUpload1.SaveAs(fileLocation);
throws following exception
at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) [0x00000] in :0 at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize) [0x00000] in :0 at (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,int) at System.IO.File.Create (System.String path, Int32 bufferSize) [0x00000] in :0 at System.IO.File.Create (System.String path) [0x00000] in :0 at System.Web.HttpPostedFile.SaveAs (System.String filename) [0x00000] in :0 at nridubai_admin_tstFileUpload.Button5_Click (System.Object sender, System.EventArgs e) [0x00000] in :0
Please note that i am using mono platform on server.
Please help me.
Thanks in advance