Welcome Guest Search | Active Topics | Sign In | Register

AJAXUploader PostedFiles Empty Options
Padishar
Posted: Monday, October 22, 2007 8:54:53 AM

Rank: Newbie
Groups: Member

Joined: 7/18/2007
Posts: 8
Greetings,
I am working with your demo controls (EO.Web.dll v4.0.20.2) and I am having an issue with the AJAXUploader. The control was added to the page using the following (filtered for simplicity's sake) markup:


Code: HTML/ASPX
<asp:Panel ID="pnlOveralPage" runat="server">
    <table>
        <tr>
            <td><%--Other page content, etc...--%></td>
        </tr>
        <tr>
            <td>
                <asp:UpdatePanel ID="upFileUpload" runat="server"  UpdateMode="Conditional">
                    <Triggers>
                        <%--Assorted triggers for switching the panels, etc...--%>
                    </Triggers>
                    <ContentTemplate>
                        <div class="FormPanelContainer">
                            <asp:LinkButton ID="lnkFile_Save" runat="server" Text="[Save]" />
                            <%--Additional panels for a current file list via GridView, and other 
                                panel state changing buttons, like: Insert & Cancel, etc... --%>
                            <asp:Panel ID="pnlFileUpload" runat="server" Visible="True">
                                <eo:AJAXUploader ID="AJAXUploader1" runat="server" Width="250px"
                                    TempFileLocation="~/fileuploads/temp" MaxDataSize="30000"
                                    AutoPostBack="false" EnableViewState="true">
                                </eo:AJAXUploader>
                            </asp:Panel>
                        </div>
                    </ContentTemplate>
                </asp:UpdatePanel>
            </td>
        </tr>
    </table>
</asp:Panel>


By design, using the link button's ("lnkFile_Save") click event, on the server side the intention is to handle saving the file from the uploaded "eouploader.{GUID}.data" file and transferring it to a usible directory on the server (one not managed for deletion by the control, i.e. somewhere other than the "temp" directory). Where the code-behind for this event handler looks similar to this:


Code: Visual Basic.NET
Protected Sub lnkFile_Save_Click(ByVal sender As Object, _
                                 ByVal e As System.EventArgs) _
                                 Handles lnkFile_Save.Click
    Dim files As EO.Web.AJAXPostedFile() = Me.AJAXUploader1.PostedFiles
    For Each file AS EO.Web.AJAXPostedFile In files
        'Code to handle copying from the /temp directory to the
        'appropriate "perminant" directory for use by the site.
    Next
    Me.AJAXUploader1.ClearPostedFiles()
    Me.AJAXUploader1.Dispose()
    'Sort the GridView showing the uploaded files
    'and switch the panel to the proper view, etc...
End Sub 'lnkFile_Save_Click


And so, when I step through the code, I notice that the "files" object has a length of zero, eventhough the control properly uploads the files (I can see them in the /temp directory) and lists them in the delete list prior to clicking the "[Save]" button. I have made sure that the proper service account has write permissions to the temp directory as well as the other "appropriate" resulting directory(s). But, for some odd reason the Uploader control does not have any files in its PostedFiles array when processing this click event. Any advice about solving this issue would be appreciated. It is completely possible that I am missing something basic about your control here...

Thanks in advance,
Padishar Brick wall
eo_support
Posted: Friday, October 26, 2007 10:49:49 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,217
Hi Padishar,

We apologize for the delay. Somehow this post fell into the crack. We are looking into it now and will get back to you as soon as we find anything.

We will be more careful reviewing all posts. Also should such situation occurs again, please directly reply the unanswered post and we will be notified again.

Thanks
eo_support
Posted: Friday, October 26, 2007 11:09:54 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,217
Hi Padishar,

We verified your code with version 4.0.43.2 (which I would recommend you to upgrade to because it fixed many bugs, you can get the list of bugs fixed in our announcements section) with the following steps:

1. Create an empty ASP.NET AJAX project;
2. Create an empty page;
3. Place an asp:ScriptManager control in the page;
4. Copy your code into both .aspx and .vb file;

We then run the page and do see files in PostedFiles property. We removed Dispose call since it is not necessary.

Can you try the same and see if you get the same result? If so then it might have something to do with the GridView and we will start to look into there. If it doesn't, please send your test project to us and we will see if there is any difference between our test projects; If that does not reveal anything, we may need to set up an online meeting so that we can obverse it on your machine if you allow so.

As an alternative, you can use FileUploaded event. That event is fire regardless what triggered the postback. So if you have two buttons that triggers postback, instead of putting the file handling code in both event handlers, you can handle them at one place in FileUploaded event.

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.