| Author: T.S. Haritha 13 Nov 2008 | Member Level: Silver Points : 0 |
It is good. I tried it. it works perfectly.
But i tried to capture the file path of uploaded image in .aspx.cs file i am unable to do it. Can you please tell me how i can do it?
|
| Author: Ilyas 19 Jan 2009 | Member Level: Silver Points : 2 |
Hi,
You can get the Path of the file by create object for HtmlfileuploadCollection like this:
protected void btnSubmit_Click(object sender, EventArgs e) { HttpFileCollection uploads = HttpContext.Current.Request.Files; for (int i = 0; i < uploads.Count; i++) { FileName += Path.GetFileName(uploads[i].FileName)+" "; } for (int i = 0; i < uploads.Count; i++) { if (uploads[i].ContentLength > 0) { string c=Path.GetFileName(uploads[i].FileName); try { uploads[i].SaveAs("C:\\UploadedUserFiles\\" + c); Span1.InnerHtml = "Upload(s) Successful."; } catch { Span1.InnerHtml = "Upload(s) FAILED."; } } }Response.Write(FileName); }
With Reagrds
Ilyas F
|
| Author: Sasikumar 18 Feb 2009 | Member Level: Gold Points : 1 |
Hello
U can use this.
FuImage --> File upload Control ImgPhoto --> Image Control
If fuImage.HasFile Then fuImage.PostedFile.SaveAs(Server.MapPath("UploadedImages/" & fuImage.FileName)) imgphoto.ImageUrl = "UploadedImages/" & fuImage.FileName
End
|
| Author: Sathish 18 Feb 2009 | Member Level: Gold Points : 2 |
Design page ===========
| CssClass="validator" Display="Dynamic" ErrorMessage="Please Upload a .jpg file."> ValidationExpression=".*(\.jpg|\.JPG|\.jpeg|\.JPEG)$" > | Text="Upload Image" Width="112px" OnClientClick="ChecksystemhasImage()" /> |
VB === Protected Sub btnUpload_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnUpload.Click FuPicture.PostedFile.SaveAs(Server.MapPath("staffphoto/" & FuPicture.FileName)) Dim strscript As String imgPhoto.ImageUrl = "staffphoto/" & FuPicture.FileName End Sub
|