Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

how to preview image using ajax asynchronous file upload control

$
0
0

Hello Friends ,i want to upload an image the moment i upload the file i want to view in my image control..I tried a lot friends i cannot achieve it please help me Friends to achieve it...

This is my aspx code------ 

<td style="text-align: left">
<div>
<asp:AsyncFileUpload ID="fileUpload1" CompleteBackColor="White" Width="350px" runat="server" UploaderStyle="Modern" UploadingBackColor="#CCFFFF" ThrobberID="imgLoad" OnUploadedComplete="fileUploadComplete" />
<asp:Image ID="imgLoad" runat="server" ImageUrl="loading.gif" />
</div>
<div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Image ID="Image1" runat="server" Height="250" Width="250" />
</ContentTemplate>
</asp:UpdatePanel>
</div>

</td>

this is my cs code---

protected void fileUploadComplete(object sender, AsyncFileUploadEventArgs e) {
Thread.Sleep(1000); string filename = System.IO.Path.GetFileName(fileUpload1.FileName);
completeurl=@"Files/" + filename;
fileUpload1.SaveAs(Server.MapPath(completeurl));

Image1.ImageUrl = "~\\Files\\200.jpg";
}

Please help me friends---


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>