Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ project at the moment is [tus](https://tus.io/).
- [DropzoneJS](#dropzonejs-driver)
- [Flow.js](#flow-js-driver)
- [Resumable.js](#resumable-js-driver)
- [simple-uploader.js](#simple-uploader-js-driver)
- [Identifiers](#identifiers)
- [Session identifier](#session-identifier)
- [Contribution](#contribution)
Expand Down Expand Up @@ -144,13 +145,14 @@ If you wrote a custom driver that others might find useful, please consider addi

Below is a list of available drivers along with their individual specs:

Service | Driver name | Chunk upload | Resumable
-------------------------------------|----------------|--------------|-----------
[Monolith](#monolith-driver) | `monolith` | no | no
[Blueimp](#blueimp-driver) | `blueimp` | yes | yes
[DropzoneJS](#dropzonejs-driver) | `dropzone` | yes | no
[Flow.js](#flow-js-driver) | `flow-js` | yes | yes
[Resumable.js](#resumable-js-driver) | `resumable-js` | yes | yes
Service | Driver name | Chunk upload | Resumable
-------------------------------------------------|----------------------|--------------|-----------
[Monolith](#monolith-driver) | `monolith` | no | no
[Blueimp](#blueimp-driver) | `blueimp` | yes | yes
[DropzoneJS](#dropzonejs-driver) | `dropzone` | yes | no
[Flow.js](#flow-js-driver) | `flow-js` | yes | yes
[Resumable.js](#resumable-js-driver) | `resumable-js` | yes | yes
[simple-uploader.js](#simple-uploader-js-driver) | `simple-uploader-js` | yes | yes

### Monolith driver

Expand Down Expand Up @@ -180,6 +182,12 @@ This driver handles requests made by the Flow.js client library.

This driver handles requests made by the Resumable.js client library.

### simple-uploader.js driver

[website](https://github.com/simple-uploader/Uploader)

This driver handles requests made by the simple-uploader.js client library.

## Identifiers

In some cases an identifier is needed for the uploaded file when the client side library does not provide one.
Expand Down
24 changes: 23 additions & 1 deletion config/chunk-uploader.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
| throughout your application here. By default, the module is setup for
| monolith upload.
|
| Supported: "monolith", "blueimp", "dropzone", "flow-js", "resumable-js"
| Supported: "monolith", "blueimp", "dropzone", "flow-js", "resumable-js",
| "simple-uploader-js"
|
*/

Expand Down Expand Up @@ -184,4 +185,25 @@

],

/*
|--------------------------------------------------------------------------
| simple-uploader.js Options
|--------------------------------------------------------------------------
|
| Here you may configure the options for the simple-uploader.js driver.
|
*/

'simple-uploader-js' => [

// The name of the multipart request parameter to use for the file chunk
'param' => 'file',

// HTTP method for chunk test request.
'test-method' => Illuminate\Http\Request::METHOD_GET,
// HTTP method to use when sending chunks to the server (POST, PUT, PATCH).
'upload-method' => Illuminate\Http\Request::METHOD_POST,

],

];
30 changes: 30 additions & 0 deletions src/Driver/SimpleUploaderJsUploadDriver.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

namespace CodingSocks\ChunkUploader\Driver;

class SimpleUploaderJsUploadDriver extends ResumableJsUploadDriver
{
public function __construct($config)
{
$config['parameter-namespace'] = '';
$config['parameter-names'] = [
// The name of the chunk index (base-1) in the current upload POST parameter to use for the file chunk.
'chunk-number' => 'chunkNumber',
// The name of the total number of chunks POST parameter to use for the file chunk.
'total-chunks' => 'totalChunks',
// The name of the general chunk size POST parameter to use for the file chunk.
'chunk-size' => 'chunkSize',
// The name of the total file size number POST parameter to use for the file chunk.
'total-size' => 'totalSize',
// The name of the unique identifier POST parameter to use for the file chunk.
'identifier' => 'identifier',
// The name of the original file name POST parameter to use for the file chunk.
'file-name' => 'filename',
// The name of the file's relative path POST parameter to use for the file chunk.
'relative-path' => 'relativePath',
// The name of the current chunk size POST parameter to use for the file chunk.
'current-chunk-size' => 'currentChunkSize',
];
parent::__construct($config);
}
}
6 changes: 6 additions & 0 deletions src/UploadManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use CodingSocks\ChunkUploader\Driver\FlowJsUploadDriver;
use CodingSocks\ChunkUploader\Driver\MonolithUploadDriver;
use CodingSocks\ChunkUploader\Driver\ResumableJsUploadDriver;
use CodingSocks\ChunkUploader\Driver\SimpleUploaderJsUploadDriver;

class UploadManager extends Manager
{
Expand Down Expand Up @@ -39,6 +40,11 @@ public function createResumableJsDriver()
return new ResumableJsUploadDriver($this->app['config']['chunk-uploader.resumable-js']);
}

public function createSimpleUploaderJsDriver()
{
return new SimpleUploaderJsUploadDriver($this->app['config']['chunk-uploader.simple-uploader-js']);
}

/**
* Get the default driver name.
*
Expand Down
Loading