Coder Social home page Coder Social logo

sankar4n / celerft Goto Github PK

View Code? Open in Web Editor NEW

This project forked from adminastoolsmith/celerft

0.0 2.0 0.0 97 KB

A file uploader that supports Gigabit sized files and the resumption of a file upload.

License: MIT License

JavaScript 67.65% C# 18.15% ASP 0.11% HTML 14.08%

celerft's Introduction

CelerFT

Description

CelerFT is a file upload tool that allows you to upload up to 5 files at a time to a web server. CelerFT uses the HTML5 File API to split the file into chunks and then uploads each chunk to the web server. Once the all of the chunks are uploaded a merge request is sent to the web server to assemble the chunks into the file. On the completion of the merge request the MD5 checksum is generated for the uploaded file and the local file.

Web servers have a maximum file upload size and CelerFT is able to get around this by splitting the file into chunks and uploading each of the chunks to the web server. This allows CelerFT to support the uploading of Gigabit sized files.

CelerFT supports the resuming of a file upload and also supports the simultaneuos uploading of several file chunks.

The client side portion of CelerFT is written as a Javascript module and requires that the browser supports the HTML5 File API, HTML5 Web Workers, HTML5 Nested Web Workers, and the HTML5 XMLHTTPRequest Level 2. If the web browser does not support HTML5 Nested Web Workers then the subworkers.js polyfill can be used to provide this support.

CelerFT is added to your application by adding the celerft.js module to your web page as shown in the following example:

    <script src="Scripts/jquery-2.1.1.min.js"></script>
    <script src="Scripts/subworkers.js"></script>
    <script src="Scripts/celerft.js"></script>

Once the celerft.js module is added to the web page CelerFT is activated in the page by creating a new CelerFT object and passing an options object to it. The options object should contain the id of all the UI controls that CelerFT needs to interact with. This includes the upload and resume buttons and the file control. The urls for the backend services should be passed to CelerFT in the options object as well.

    <script type="text/javascript">
        $(document).ready(function () {

            <!-- Check browser compatability -->
            if (!(window.File && window.Blob && window.FormData)) {
                alert("Please upgrade your browser to one that supports the HTML5 file api.");
                return;
            }

            if (typeof Worker == "undefined") {
                alert("Please upgrade your browser to one that supports the HTML5 Webworker api.");
                return;
            }

            // options to send to the celerft.js
            // We are going to use JQuery to select the controls so we put a #
            // at the start of the name for the non-button controls
            var uicontrols = {

                cancelbuttonid: 'cancel_workers',
                directoryselectorid: '#select_directory',
                errorcontrolid: '#errormessage',
                fileselectorid: '#select_file',
                fieldsetid: '#file_name',
                pausebuttonid: undefined,
                progressbarid: '#progressbar',
                resumebuttonid: 'resume_upload',
                selectasnycstateid: '#select_asyncstate',
                selectparalleluploadid: '#select_parallelupload',
                tdfileid: '#file',
                tdlocalchecksumid: '#local',
                tdremotechecksumid: '#remote',
                uploadbuttonid: 'upload_file'
            }

            var urls = {

                checksumurl: '/api/CelerFTFileUpload/GetChecksum',
                chunkinfourl: '/api/CelerFTFileUpload/GetChunkInfo',
                fileinfourl: '/api/CelerFTFileUpload/GetFileInfo',
                mergeallurl: '/api/CelerFTFileUpload/MergeAll',
                uploadurl: '/api/CelerFTFileUpload/UploadChunk',
            }

            var options = {

                bytesperchunk: undefined,
                maxFiles: 5,
                maxParallelUploads: 2,
                uploadlargfileasync: false,
                uicontrols: uicontrols,
                urls: urls,
                xfilenameuploads: false
            }


            var cft = new CelerFT(options);
            cft.init();

        });
    </script>
Supported Backends

CelerFT web server backends examples are provided in Node.JS and the ASP .NET Web API.

Dependencies

CelerFT requires JQuery and the SparkMD5 library.

celerft's People

Contributors

adminastoolsmith avatar

Watchers

Sankaran Kaliappan avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.