- settings :
object
vulcanup settings by default.
- jQuery
jQuery object.
- jQuery.fn
The jQuery plugin namespace.
- jQuery.vulcanup
The plugin global configuration object.
vulcanup settings by default.
Kind: global namespace
- settings :
object
- .type :
String
- .url :
String
- .name :
String
- .enableReupload :
Boolean
- .imageContain :
Boolean
- .imageResize :
Boolean
- .imageMinHeight :
Number
- .imageMaxHeight :
Number
- .canRemove :
Boolean
- .showValidations :
Boolean
- .handler :
function
- .fileupload :
Object
- .url :
String
- .type :
String
- .paramName :
String
- .minFileSize :
Number
- .maxFileSize :
Number
- .acceptFileTypes :
RegExp
- .url :
- .types :
Object
- .messages :
Object
- .icons :
Object
- .type :
The kind of file the uploader will treat: all
| image
| pdf
.
Kind: static property of settings
Default: 'all'
This is the initial value.
Kind: static property of settings
Default: null
If there is an url, the initial file name. Is optional.
Kind: static property of settings
Default: ''
Enable file reupload. If false, once the file is uploaded, you have to delete it in order to upload another in its place.
Kind: static property of settings
Default: true
On type image, if the image is treated as background contain, instead of cover and being resized.
Kind: static property of settings
Default: false
On type image, resize the image visualizator when the image is loaded. If this is set to false, the background will have to be resized manually.
Kind: static property of settings
Default: true
Minimum image height in pixels.
Kind: static property of settings
Default: 100
Maximum image height in pixels.
Kind: static property of settings
Default: 400
If the file can be removed, insert an option to do so.
Kind: static property of settings
Default: true
Show the validations visually. Programmer has to attach an event handler to detect errors if set to false.
Kind: static property of settings
Default: true
Server response handler. If set, this will overwrite the way to treat the
response from server when the file is uploaded. This function receives as
first parameter the response from server and have to return an object with
the an url
property with the file url.
Kind: static property of settings
Default: null
File upload plugin options.
Kind: static property of settings
- .fileupload :
Object
- .url :
String
- .type :
String
- .paramName :
String
- .minFileSize :
Number
- .maxFileSize :
Number
- .acceptFileTypes :
RegExp
- .url :
URL to upload files.
Kind: static property of fileupload
Default: '/api/files'
XHR type.
Kind: static property of fileupload
Default: 'POST'
The file param name.
Kind: static property of fileupload
Default: 'file'
minFileSize in bytes
Kind: static property of fileupload
Default: 1 (1 byte)
maxFileSize in bytes
Kind: static property of fileupload
Default: 2000000 (2MB)
acceptFileTypes
Kind: static property of fileupload
Default: undefined (any file)
The type of files accepted. Every property (the type id) should be an object describing:
- {String} name - The name of the file for the user.
- {RegExp} formats - The regexp to validate the file type.
- {String} formatsText - The list of formats for the user.
Kind: static property of settings
All messages used.
Kind: static property of settings
All icons used.
Kind: static property of settings
jQuery object.
Kind: global external
See: http://api.jquery.com/jQuery/
The jQuery plugin namespace.
Kind: global external
See: The jQuery Plugin Guide
- jQuery.fn
- .vulcanup(update, fileInfo) ⇒
jQuery
- .vulcanup(get) ⇒
Object
|null
- .vulcanup([settings])
- .vulcanup(update, fileInfo) ⇒
Invoke over instantiated elements.
Update the current file as uploaded.
Kind: static method of jQuery.fn
Returns: jQuery
- The same element.
Param | Type | Description |
---|---|---|
update | String |
With value 'update' . |
fileInfo | Object |
The file details. |
fileInfo.url | String |
The file URL. |
[fileInfo.name] | String |
The file name. |
Example
$('#inputFile').vulcanup('update', {
url: '/path/to/file.ext'
});
Invoke over instantiated elements.
Get the current uploaded file.
Kind: static method of jQuery.fn
Returns: Object
| null
- The file info or null if there is no file.
Param | Type | Description |
---|---|---|
get | String |
With value 'get' . |
Example
const fileInfo = $('#inputFile').vulcanup('get'); // { url, name }
Invoke on a <input type="file">
to set it as a file uploader.
By default the configuration is settings but you can pass an object to configure it as you want.
Listen to event changes on the same input, review demo to see how to implement them and what parameters they receive:
vulcanup-val
- On validation error. Receives as parameter an object with the error message.
vulcanup-upload
- On file started to being uploaded.
vulcanup-progress
- On upload progress update. Receives as parameter the progress number.
vulcanup-error
- On server error. Receives as parameter an object with details.
vulcanup-change
- On file change. This is triggered when the user uploads
a file in the server, when it is deleted or when it is changed programmatically.
Receives as parameter an object with the new file details.
vulcanup-delete
- On file deleted. Receives as parameter the deleted file details.
vulcanup-uploaded
- On file uploaded in the server.
vulcanup-complete
- On upload process completed. This is fired when the
XHR is finished, regardless of fail or success.
Kind: static method of jQuery.fn
Param | Type | Description |
---|---|---|
[settings] | settings |
Optional configuration. |
Example
$('input[type=file]').vulcanup({
url: '/initial/file/url.ext'
});
The plugin global configuration object.
Kind: global external
Properties
Name | Type | Description |
---|---|---|
version | String |
The plugin version. |
defaults | settings |
The default configuration. |
templates | Object |
The default templates. |