Hi all,
In my form i have listbox,file upload control and button .

Using file upload control am adding the files to listbox which i want to upload to server.
On clicking button, i want the files to be uploaded to server which are in listbox.


Please suggest me how to do this.

Regards,
Shravan.D

Recommended Answers

Add a FileUpload control to your page

<asp:FileUpload ID="FileUpload" runat="server" Width="408px" />

And then add this code to your upload button

'Save uploaded file to server
FileUpload.PostedFile.SaveAs(Server.MapPath("~/UserImages/") & _
                             FileUpload.PostedFile.FileName)
Jump to Post

All 2 Replies

Add a FileUpload control to your page

<asp:FileUpload ID="FileUpload" runat="server" Width="408px" />

And then add this code to your upload button

'Save uploaded file to server
FileUpload.PostedFile.SaveAs(Server.MapPath("~/UserImages/") & _
                             FileUpload.PostedFile.FileName)

thanks for ur reply,

but files which are to be upload are in listbox not in fileupload control.

(i want to upload files from listbox to server not from fileupload control.)

Here Listbox contains full path of the files.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.