AjaxUploader OnFileUploaded

Last post 10-18-2008, 11:23 PM by cutechat. 1 replies.
Sort Posts: Previous Next
  •  10-17-2008, 8:33 AM 44959

    AjaxUploader OnFileUploaded

    Hello,
     
    I'm from Brazil and I'm testing Ajax Uploader.
    I  want a event to call a client-side function after file upload, something like this:

    <CuteWebUI:Uploader  runat="server" ID="MyUploader" OnUploadedClient="MyUploader_UploadedClient"></CuteWebUI:Uploader>
    <script type="text/javascript">
    funcion MyUploader_UploadedClient(uploaddetails)
    {
      alert(uploaddetails.Name);
    }
    </script>
     
    Today I can do something like that?
    If I don't, are you intend do it?
     
    This is to create uploaded images on client-side  without need uploadpanel from M$ Ajax, is better because in my need I just want to create 1 image on screen and my list of images is large like 50 images on a grid, if I put a update panel, i need put it at entire grid and the process will be slow.
     
    Thank you,
    Filed under:
  •  10-18-2008, 11:23 PM 44970 in reply to 44959

    Re: AjaxUploader OnFileUploaded

    Hi,
     
    Please check this thread for client script API:
     
    You can do it like this :
     
    <scrpt>
    function CuteWebUI_AjaxUploader_OnPostback()
    {
     var hidden=this;
     //currently you are not able to get the filename of the upload task.
     ///DoYourCustomAjaxPostBack();
     //return false;//cancel the default postback
    }
    </script>
     
    You need understand that , the OnPostback handler is fired at client side , before the server-FileUploaded
     
    That means , the file is uploaded , and the page need postback to fire the server-FileUploaded.
     
    So the function CuteWebUI_AjaxUploader_OnPostback does not mean you have saved the file on the server.
     
     
    If you want to do something after the server-FileUploaded , I think you can do that at server side :
     
    private void Uploader1_FileUploaded(...)
    {
       string fileshortname=args.FileName;
       args.MoveTo(mynewfilepath);
       SendScriptToTellClientUploadOK(fileshortname);
    }
     
     
    -----------------------------------------------------------------------------------------
     
    The page should postback once to let server-FileUploaded event being fired.
     
    If you don't want to use Microsoft Ajax , you need use another Ajax framework for that.
     
    For your requests , I will write a sample later to implement your ideas.
     
     
    Regards,
    Terry
     
     
View as RSS news feed in XML