An open API service indexing awesome lists of open source software.

https://github.com/anduin2017/jquery-progress-upload

A library to show progress and open button for file uploader.
https://github.com/anduin2017/jquery-progress-upload

Last synced: about 1 year ago
JSON representation

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

Awesome Lists containing this project

README

          

# jquery-progress-upload

[![npm](https://img.shields.io/npm/v/jquery-progress-upload.svg?style=flat)](https://www.npmjs.com/package/jquery-progress-upload)
[![ManHours](https://manhours.aiursoft.cn/r/gitlab.aiursoft.cn/anduin/jquery-progress-upload.svg)](https://gitlab.aiursoft.cn/anduin/jquery-progress-upload/-/commits/master?ref_type=heads)

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

## How to install

```bash
npm install jquery-progress-upload
```

And add your reference:

```html

```

## How to use

### Client side

Create a form

```html

```

Add add the following javascript.

```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#)

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

## API

```javascript
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);
```