.CS
Private int uploadPic () {if (myfile.postedfile! = null) {Try {string filedir = "c: // ibrary // PagePic //"; // Note You can change to the directory you want to upload String FileName = System.IO.Path.GetFileName (myFile.PostedFile.FileName); string filePath = System.IO.Path.Combine (fileDir, fileName); LfikePath.Text = filePath; myFile.PostedFile.SaveAs (filePath);} catch ( Exception EXC) {this.alertBox; return -1;}}
Return 0;}
Private void bsubmit_click (Object sender, system.eventargs e) {if (uploadPic () == - 1) {return;}}
.aspx
<< Input id = "myfile" type = "file" οnchange = "document.all.ifytp.src = this.Value" runat = "server" >> << asp: image id = "iftp" runat = "server" Width = "72px" >> << / asp: image >>