where the files are uploaded/saved using "FileUpload" Control

Posted by Shreesh under ASP.NET on 10/13/2011 | Points: 10 | Views : 1048 | Status : [Member] | Replies : 2
Hello,
can anyone tell me where the files are uploaded using "FileUpload" Control.I have used the following code

protected void Button1_Click(object sender, EventArgs e)
{
cmd.Connection = con;
cmd.CommandType = CommandType.StoredProcedure;

cmd.Parameters.AddWithValue("@Path1",FileUpload1 );
Path1 = Server.MapPath("upload");

if (FileUpload1.PostedFile .FileName !=null && FileUpload1.PostedFile .ContentLength >0)
{


string filename = Path.GetFileName(FileUpload1.PostedFile.FileName);
string savetoupload = Path1 + "D:\\new" + filename;
Label1.Text = "file uploaded" + filename;

}
}
}


obviously the file isn't saved in D: either.




Responses

Posted by: Alex_4youin on: 10/13/2011 [Member] Starter | Points: 25

Up
0
Down
FileUpload1.SaveAs(Server.MapPath("PathHere") + filename);

Shreesh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ndebata on: 10/13/2011 [Member] Starter | Points: 25

Up
0
Down
If you do not want to save any thing to database remove cmd sections.
go though this tutorial to know how fileupload control works
http://www.dotnetfunda.com/tutorials/controls/fileupload.aspx
http://msdn.microsoft.com/en-us/library/aa479405.aspx


Shreesh, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response