Click here to Skip to main content
15,906,106 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HI Friends,

How to upload a photo to an aspx form and displaying it at the same time before saving the photo to the database....?

Using ajax or any control,please give me a solution.
Posted
Comments
ram mohan 18-Jan-13 3:38am    
upload the photo using fileupload control. In page load event, bind the photo path to image control if file name is not null.
PRAKASH_N 18-Jan-13 5:10am    
How do i get the path of a file from FileUpload control???
Member 9740741 19-Jan-13 2:23am    
FileUpload1.FileName;

XML
<asp:FileUpload ID="fileup1" runat="server" Text="Browse" />

string FilePath = fileup1.PostedFile.FileName;


where 'fileup1is' the fileupload controll name...
 
Share this answer
 
Hello Dear ,

You Can use image control like given below--

<asp:image id="Image2" runat="server" width="317" height="104" xmlns:asp="#unknown">

After upload code (when code upload file at the location) .you can use that file Like this example below-


imgstudy.ImageUrl = "ImageNAme" + "?time=" + DateTime.Now.Ticks;

in the image url you have to add Tick with QueryString.
it will give correct image.
 
Share this answer
 
Comments
rizwan muhammed khan gouri 19-Jan-13 7:28am    
give full Explaination please (happy)
PRAKASH_N 21-Jan-13 2:45am    
yes please explain it
[no name] 21-Jan-13 2:53am    
most of the time when we upload file in folder
then at the time Root is not refresh thats why image not displaying at the time
so we can use tick it will add time in image file name with query String
and we can get original image at the time.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900