Get Total file size when flash and silverlight are disabled/uninstalled

Last post 04-26-2010, 10:50 PM by cutechat. 4 replies.
Sort Posts: Previous Next
  •  04-22-2010, 12:04 PM 60317

    Get Total file size when flash and silverlight are disabled/uninstalled

    I'm currently testing several fail-over possibilities in case the client has limited browser capabilities. Is there a way we can retrieve total file size of a selected file before it is submitted to the server? With both flash and silverlight disabled, so far I have not found a way other than using the server side events; however, I would like to be able to determine that before anything is submitted that way no unnecessary bandwidth is used.
     
    I'm currently using "UploadAttachments" control. Thanks in advance for any help.
     
    Jerry
  •  04-22-2010, 2:28 PM 60325 in reply to 60317

    Re: Get Total file size when flash and silverlight are disabled/uninstalled

    Dear ggar,
     
    Please use the following method:
    <script>
    function CuteWebUI_AjaxUploader_OnSelect(selects)
    {
     var uploader=this;
     var queues=uploader.getitems();
     var queuesize=0;
     for(var i=0;i<queues.length;i++)
     {
      
      if(queues[i].Status=="Error")
       continue;
      queuesize+=queues[i].FileSize;
     }
     var selectsize=0;
     for(var i=0;i<selects.length;i++)
     {
      selectsize+=selects[i].FileSize;
     }
     var totalsize=queuesize+selectsize;
     if(totalsize>10*1024*1024)
     {
      alert("you cant upload 10M files");
      return false;
     }
    }
    </script>
     
    Regards,
    Eric
  •  04-22-2010, 7:08 PM 60334 in reply to 60325

    Re: Get Total file size when flash and silverlight are disabled/uninstalled

    Thanks for the quick response Eric. Unfortunately, this doesn't work. My issue is trying to get these sizes on the client side without using either silverlight or flash. I'm thinking it is not currently possible; only on the server side.
     
    If you have any other suggestions or tips, I'd really appreciate it. Thanks again.
  •  04-23-2010, 7:39 AM 60348 in reply to 60334

    Re: Get Total file size when flash and silverlight are disabled/uninstalled

    Dear ggar,
     
    The feature of Selecting Multiple files Upload needs Flash or Silverlight installed. Otherwise it will use an Iframe solution which allows you upload multiple files but selecting one file only.
    Hope it helps.
     
    Regards,
    Eric
  •  04-26-2010, 10:50 PM 60432 in reply to 60334

    Re: Get Total file size when flash and silverlight are disabled/uninstalled

    Hi,
     
    When use IFrame, we can't get the filesize at client side.
     
    So the client API .FileSize will be -1
     
    Regards,
    Terry
     
View as RSS news feed in XML