How to make FileUpload control upload file right after clicking 'Browse'?

devilzsniper

New Member
Untill now, I've been using 2 controls (FileUpload and additional button).After file was chosen in a fileUpload control, user had to accept his choice by pressing save button.Here's button's code:\[code\] protected void Button1_Click(object sender, EventArgs e) { if (FileUpload1.HasFile) { FileUpload1.SaveAs(Server.MapPath("~/file.jpg")); Label1.Text = Server.MapPath("~/file.jpg"); Image1.ImageUrl = "file.jpg"; } }\[/code\]I'm wondering whether there is a way to avoid using that button, so the FileUpload control's button would do the additional button's job.
 
Back
Top