How do I load an image when the file system control is in the refresh area?
How do I upload an image when the file is uploading under the refresh bar?
I have an "upload" button inside this update panel.
When I click this button inside a button click event, I got filefile = false. Please suggest if there is any way to upload the image file when the file system control is inside the refresh panel and the button does asyncpostback.
Thanks in advance.
source to share
you can use AJAX AsyncFileUpload control
http://www.asp.net/AJAX/AjaxControlToolkit/Samples/AsyncFileUpload/AsyncFileUpload.aspx
Also check this thread. Uploading file to AJAX updatepanel without full postback
source to share
It's impossible. For security reasons, the browser does not allow the download of javascript files.
There are two common workarounds for this problem:
- Upload to iFrame
- Use a plugin to download
I recently applied this tool to add files to my webpage asynchronously and it works nicely: http://valums.com/ajax-upload/ It automatically creates an iFrame and sends a frame and sends the resulting html (or json object) to the handler events. My page that receives the uploaded file returns a json object describing the file, eg. filename and unique id so that I can link the data posted on the master page in the uploaded file.
For security purposes, I store the credentials of the user uploading the file, so when the form is posted, I can verify that the user who is publishing the form is indeed the user who uploaded the file.
source to share
I have tried as shown below. He works.
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="conditional">
<ContentTemplate>
<asp:FileUpload ID="FileUpload1" runat="server" />
<asp:Button ID="Upload" runat="server" Text="Upload" OnClick="Upload_Click" /><br />
<asp:Image ID="NormalImage" runat="server" /></ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="Upload" />
</Triggers>
</asp:UpdatePanel>
Link to
source to share