Welcome Guest Search | Active Topics | Sign In | Register

Two postbacks and the uploaded file is lost! Options
Daniele
Posted: Wednesday, September 23, 2009 11:00:40 AM
Rank: Newbie
Groups: Member

Joined: 9/3/2009
Posts: 5
Hello everyone,

I'm using the AJAXUploader, this is part of my code:

Code: HTML/ASPX
<eo:AJAXUploader ID="UploaderRic" runat="server" BrowseButtonText="Sfoglia..."
                                            CancelButtonText="Cancella" UploadButtonText="Carica" width="400"
                                            AllowedExtension="pdf" ClientSideOnError="error_handler"
                                            ProgressTextFormat="Caricamento in corso - {percentage}%"
                                            AutoPostBack="false" PostedFileLabelFormat="{posted_file_name}" 
                                            MaxFileCount="1">
                                            <LayoutTemplate>
                                                <table>
                                                    <tr>
                                                        <td style="text-align:left">
                                                            <asp:PlaceHolder ID="InputPlaceHolder" runat="server">Input Box Place Holder</asp:PlaceHolder>
                                                        </td>
                                                        <td style="text-align:right">
                                                            <asp:Button ID="UploadButton" runat="server" Text="Carica" />
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                    </tr>
                                                    <tr>
                                                        <td style="text-align:left">
                                                            <eo:ProgressBar ID="ProgressBar" runat="server" Width="330" ControlSkinID="Windows_XP" />
                                                        </td>
                                                        <td style="text-align:right">
                                                            <asp:Button ID="CancelButton" runat="server" Text="Annulla" />
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <asp:PlaceHolder ID="ProgressTextPlaceHolder" runat="server">Progress Text Place Holder</asp:PlaceHolder>
                                                             
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td style="padding-right: 5px; text-align:left;">
                                                            <asp:PlaceHolder ID="PostedFilesPlaceHolder" runat="server">Posted Files</asp:PlaceHolder>
                                                             
                                                        </td>
                                                        <td style="text-align:'right'">
                                                             <asp:Button ID="DeleteButton" runat="server" Text="Elimina" />
                                                        </td>
                                                    </tr>
                                                </table>
                                            </LayoutTemplate>
                                        </eo:AJAXUploader>




In my page I also have more controls (radiobuttons etc.) that cause the page to postback.
I don't use AutoPostBack, because I want to upload a file and then click a "submit" button.
If I upload a file (clicking on the "browse" button and then on the "UploadButton" button) everything works, I find my uploaded file, which I can delete or submit.
My problem is: after uploading a file, if I don't submit it and the page posts backs twice (for example by clicking twice on any radiobutton options) I loose the uploaded file.
On my tempdir there are the 3 temp files, but the control won't show the uploaded file on the page. How can I avoid this?

Thank you
Daniele

eo_support
Posted: Wednesday, September 23, 2009 11:12:18 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

This is normal. You are suppose to handle the uploader's FileUploaded event and then move the files from temp folder to wherever you really want them to be. If you don't do anything, they temp files will be deleted later by the uploader.

Also the file list for the Uploader is not meant to maintain the list of submitted files for you. It is meant to show you a list of files to be submitted so that the user is aware that they are submitting exactly these files. Once the page submits, the list should go empty if you move the temp files away. Otherwise it will try to reconstruct the list from the temp files but that is mostly useless because the temp files will be deleted by the uploader. In any case, if you wish to maintain a list of submitted files, you should keep the list yourself (for example, in ViewState or DB) and have your own UI to display it (for example, with a DataGrid).

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.