Hi friends.
I am developing an web application. here i am using file uploader and i am uploading images.
Problem here is, i need to provide preview of uploaded image as soon as file is uploaded.
How can i do this.
Regards
Rajath
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
ShankeyPosted Aug 27, 2010, 10:40 AM
Hi rajath r,
Following is your solution ,
But don't forget to mark my answer as accepted if it helped you :)
And if you want to upload .gif file then change folllowing condition
if (Extension == "jpg" || Extension == "JPG" || Extension == "JPEG" || Extension == "jpeg")
Aspx code
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
C# code
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnUpload_Click(object sender, EventArgs e)
{
if (fileUploadImage.FileName != "")
{
String fullpath = Server.MapPath(fileUploadImage.FileName);
fileUploadImage.SaveAs(fullpath);
imgShow.ImageUrl = fileUploadImage.FileName;
}
}
}
Manikavelu VelayuthamPosted Aug 27, 2010, 6:59 AM
just put a preview button over there, through that just hide and show the image. you should dynamically change the image url, so that the uploaded image will be get previewed.
Mark this post as answered, if this really helps you.