MaxFileSize Limitation

3 posts, 0 answers
  1. Jamie
    Jamie avatar
    2 posts
    Member since:
    Dec 2014

    Posted 22 Sep 2015 Link to this post

    I am currently developing a web application using the RadAsynUpload control with a "ChunkSize" set to 4MB. I am now looking to ​prevent my users ​from uploading files larger than 6GB. The RadAsyncUpload control has a "MaxFileSize" property, but unfortunately the value is factored in bytes and the data type is only defined as an integer. With this limitation, the "MaxFileSize" cannot be set above 2GB (2,147,483,647 bytes). If I do not set the "MaxFileSize" property on the RadAsyncUpload control, I can successfully upload 6GB and larger files. Because I am using the chuck upload feature, I've configured my web.config file to handle uploads slightly larger than 4MB (the chunk size). 

     

    Does anyone have a workaround for this? Thanks!

  2. Jamie
    Jamie avatar
    2 posts
    Member since:
    Dec 2014

    Posted 23 Sep 2015 in reply to Jamie Link to this post

    As a possible workaround, I've implemented the client-side JavaScript event "OnClientProgressUpdating" to retrieve the selected file size. If the size is greater than 6GB, I cancel the upload, remove the file from the upload control, and finally alert the end-user.

    If a better solution exists, or the Telerik control can be updated (or overridden) to use another data type (long?) for the "MaxFileSize" property, I'd be glad to hear about it. Thanks!

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Hristo Valyavicharski
    Admin
    Hristo Valyavicharski avatar
    975 posts

    Posted 25 Sep 2015 Link to this post

    Hi Jamie,

    You are right. MaxFileSize is interger. That's why you can try to read file's size with File Api and cancel uploading:

          <script type="text/javascript">
                var size = 0;

                function fileSelected(sender, args) {
                    // Read file size with File API
                    size = args.get_fileInputField().files[0].size;
                    
                }

                function fileUploading(sender, args) {
                    // Cancel uploading
                    if (size > 6442450944) {
                        args.get_cancel(true);
                    }
                    size = 0;
                }
            </script>


         <telerik:RadAsyncUpload runat="server" ID="asyncUpload" OnClientFileUploading="fileUploading" 
                OnClientFileSelected="fileSelected" TargetFolder="~/Uploads"></telerik:RadAsyncUpload>



    I hope this helps.

    Regards,
    Hristo Valyavicharski
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top