Skip to content

A library to show progress and open button for file uploader.

License

Notifications You must be signed in to change notification settings

NickThorne123/jquery-progress-upload

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jquery-progress-upload

npm

A library to show progress and open button for file uploader.

How to install

$ npm install jquery-progress-upload

And add your reference:

<script src="node_modules/jquery/dist/jquery.min.js"></script>
<script src="node_modules/jquery-progress-upload/src/jquery-progress-upload.js"></script>

How to use

Client side

Create a form

<form action="/api/upload" method="post" enctype="multipart/form-data">
    <input type="file" id="file" data-max-file-size="30M" />
</form>

Add add the following javascript.

var settings = { };
$('#file').setProgressedUploader(settings);

Run your app and upload a file.

Server side

Create a new action at /api/upload and save that file.

For example:(In C#)

var file = Request.Form.Files.First();
var fileStream = new FileStream(GetCurrentDirectory(), FileMode.Create);
await file.CopyToAsync(fileStream);

API

var settings = {
    onInit: function (elements) {
        //Occurs when element loads.
    },

    onGetFile: function (elements) {
        //Occurs when user put a file in it.
    },

    onStartSubmitting: function (elements) {
        //Occurs when user is submitting the form.
    },

    onProcessing: function (elements) {
        //Occurs when all data transformed.
    },

    onFinish: function (elements, data) {
        //Occurs when server gives response.
    },
    
    onError: function(e){
        //Occurs when server could not accept the file.
    }
};

$('#file').setProgressedUploader(settings);

About

A library to show progress and open button for file uploader.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HTML 100.0%