tags:

views:

80

answers:

2

hi,

i want to add file(photo) to fileupload control in the c#(code behind)

thanks

A: 

Well, then you just add a click event to the button on the fileupload control... something similar to this:

fileupload.PostedFile.SaveAs(Server.MapPath() + fileupload.PostedFile.FileName);

Robban
A: 

You can't do that.

The only possible way to get a file path into an upload control is for the user to select a file using the file selection dialog.

For security reasons you can't force a file name into the control, neither in the html code, nor using Javascript. As you can't specify it in the html, there is naturally no property for that in the server control that generates the html either.

Guffa