cannot get file to upload prior to server side code running

  •  01-14-2010, 12:09 PM

    cannot get file to upload prior to server side code running

    I want to have an uploader on a form where a file is only uploaded and then saved if there happens to be one queued up. So i want the upload to take place on the save event. I like the queue that your uploader uses I just need the uploader to finish prior to my code behind function for the save process running. 
    I am using the following code
                            <CuteWebUI:UploadPersistedFile runat="server" ID="upfUploadNewFile" AutoUseSystemTempFolder="false"
                                 InsertButtonID="lbUploadNewFile" ManualStartUpload="true" MaxFilesLimit="1" MultipleFilesUpload="false"
                                 OnFileUploaded="FileUploaded" />
    of which my button is
              <asp:Button runat="server" ID="btnSave" Text="Save" OnClick="btnSave_OnClick" OnClientClick="return btnSave_OnClientClick()" />

    as you can see my button calls a client side function then the serverside
            function btnSave_OnClientClick() {
                var uploadobj = document.getElementById('<%=upfUploadNewFile.ClientID %>');

                if (uploadobj.getqueuecount() > 0) {
                return true;
    as you can see i only trigger the javascript startupload() function if there is a file queued up
        protected void btnSave_OnClick(Object sender, EventArgs e)
            Int32 FileID = 0;

                if (upfUploadNewFile.File != null)
                    FileID = HandleFileUpload().fileID;
     for some reason when my server side function runs the (upfUploadNewFile.File != null) always return false and the serverside saving doesnt occur
     How can I resolve this issue?
View Complete Thread
Powered by Community Server (Commercial Edition), by Telligent Systems