When you use the jQuery .filePicker
plugin you can pass an object with options:
$('#filepicker').filePicker({
url: 'uploader/index.php',
maxFileSize: 10000000,
});
Url to the PHP file where the upload is handled.
n\a
uploader/index.php
Used to send data to the server.
n/a
{paramA : 'value 1', paramB: 'value 2'}
Or using a function:
data: function() {
return {
paramA: 'value 1',
paramB: $('#myinput').val(),
}
},
On the server side using the events you can access the data with:
$handler->on('upload.before', function ($file) use ($handler) {
$valueA = $handler->request()->get('paramA'); // <=> $_POST['paramA']
$valueB = $handler->request()->get('paramB'); // <=> $_POST['paramB']
});
The accepted file types.
n/a
/(\.|\/)(gif|jpe?g|png)$/i
Warning: Make sure to also set the accept_file_types PHP option too!
Files that should be handled as images. Used when displaying the thumbnail preview.
/(\.|\/)(gif|jpe?g|png)$/i
The minimum file size in bytes required.
1
1000
(= 1 Kilobyte)The maximum file size in bytes allowed.
n/a
10000000
(= 10 Megabyes)The jQuery object / selector for the file input button.
input[type="file"]
(inside the container)$('.file-input-btn')
Whether to upload multiple files in a single request.
false
When this is enabled you should not have a "Cancel" button for each file in the ui, because canceling one file will cancel the entire request with all the files.
The number of files to upload when uploading multiple files in one request.
n/a
The max size in bytes of each request when uploading multiple files in one request.
n/a
10000000
(= 10 Megabyes)The number of upload requests at the same time.
n/a
An array of plugins to be used (ui
, crop
, drop
, camera
).
[]
['ui', 'drop']
An object with all error messages.
{
uploadFallback: 'The browser does not support file uploads.',
minFileSize: 'The file must be at least :min KB.',
maxFileSize: 'The file may not be greater than :max KB.',
postMaxSize: 'The file exceeds the post max size limit of :max MB.',
invalidFileType: 'The file type is not allowed.',
error: 'Oops! Something went wrong.',
abort: 'The operation was aborted.'
// UI plugin
processing: 'Processing...',
deleteFail: 'Could not delete file :file.',
// Camera plugin
cameraError: 'Could not access the camera.',
cameraFallback: 'Your browser does not support the camera feature.',
// Crop plugin
cropLoadFail: 'Could not load the image.',
cropSaveFail: 'Could not save the image.'
}