在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):jildertmiedema/laravel-plupload开源软件地址(OpenSource Url):https://github.com/jildertmiedema/laravel-plupload开源编程语言(OpenSource Language):JavaScript 95.3%开源软件介绍(OpenSource Introduction):laravel-pluploadLaravel plupload support. Handeling chunked uploads. InstallationInstall using composer composer require jildertmiedema/laravel-plupload Add the provider to 'providers' => [
JildertMiedema\LaravelPlupload\LaravelPluploadServiceProvider::class,
] If you want to use te build in builder insert the facade 'aliases' => array(
'Plupload' => JildertMiedema\LaravelPlupload\Facades\Plupload::class,
), To publish the assets: php artisan vendor:publish Receiving filesUse this route to receive a file on the url Route::post('/upload', function()
{
return Plupload::receive('file', function ($file)
{
$file->move(storage_path() . '/test/', $file->getClientOriginalName());
return 'ready';
});
}); Sending filesThere are 3 ways to send files with this plugin. 1. Use default plupload htmlUse the examples found on the plupload site. IssuesIf you are encountering a Token Mismatch Exception;
add in your blade file
in your JS file, add headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}, Eg: $('.js-uploader').pluploadQueue({
// General settings
runtimes: 'html5,flash,silverlight,html4',
url: '/upload/',
chunk_size: '200kb',
rename: false,
dragdrop: true,
// add X-CSRF-TOKEN in headers attribute to fix this issue
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
// add more overrides; see documentation...
}); 2. Simple plupload builderTo use the builder for creating send form you can use this function: echo Plupload::make([
'url' => 'upload',
'chunk_size' => '100kb',
]); Note: The options given to the make function are found on in the pluload documentation. 3. Extended plupload builderecho Plupload::init([
'url' => 'upload',
'chunk_size' => '100kb',
])->withPrefix('current')->createHtml(); AlternativesOther packages supporting plupload: |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论