Hola a todos en este post voy a compartir con vosotros las configuaciones básicas de dropzone js y los comentarios sobre ellas.
En otro atriculo os comentaré como he integrado algunas balidaciones extra según el tipo de archivo y su peso.
/* url: defines the target for the upload form, and is the only required parameter.
That said, if you’re attaching it to a form element then it’ll simply use the form’s action attribute, in which case you don’t even need to specify that. */
url: null,
// method: sets the HTTP method and again, it’ll simply default to POST
method: "post",
withCredentials: false,
parallelUploads: 2,
uploadMultiple: false,
/* maxFilesize: determines the maximum file size in megabytes.
This defaults to a size of 1000 bytes, but using the filesizeBase property, you could set it to another value — for example, 1024 bytes.
You may need to tweak this to ensure that your client and server code calculate any limits in precisely the same way. */
maxFilesize: 70,
filesizeBase: 70,
/* paramName: is used to set the name of the parameter for the uploaded file. If you’re using a file upload form element, it will match the name attribute. If you don’t include it, it defaults to file. */
paramName: "file",
createImageThumbnails: true,
maxThumbnailFilesize: 10,
/* By default, the thumbnail is generated at 120x120px.
If you set both thumbnailWidth and thumbnailHeight to null, the thumbnail won’t be resized at all.
If you want to completely customize the thumbnail generation behavior, you can even override the resize function.
*/
thumbnailWidth: 320,
thumbnailHeight: 320,
/* maxFiles: sets the maximum number of files a user can upload, if it’s not set to null. maxFiles: null, */
maxFiles: 5,
params: {},
/* clickable: parameter to disable this by setting it to false, or alternatively you can provide an HTML element or CSS selector to customize the clickable element. */
clickable: true,
ignoreHiddenFiles: true,
/*
// acceptedFiles: can be used to restrict the type of file you want to accept. This should be in the form of a comma-separated list of MIME types
audio/* // image/* // image/jpeg,image/png...
".jpeg,.jpg,.png,.gif,..."
acceptedFiles: null,
*/
acceptedFiles: ".jpeg,.jpg,.png,.gif,.mkv,.avi,.mp4,.pdf,.doc,.docx,.txt",
acceptedMimeTypes: null,
// procesa los archivos automaticamente
autoProcessQueue: true,
autoQueue: true,
addRemoveLinks: false,
previewsContainer: null,
hiddenInputContainer: "body",
capture: null,
renameFilename: null,
/*You can use these to customize the displayed text, or to translate them into another language. */
dictDefaultMessage: "Drop files here to upload",
dictFallbackMessage: "Your browser does not support drag'n'drop file uploads.",
dictFallbackText: "Please use the fallback form below to upload your files like in the olden days.",
dictFileTooBig: "File is too big ({{filesize}}MiB). Max filesize: {{maxFilesize}}MiB.",
dictInvalidFileType: "You can't upload files of this type.",
dictResponseError: "Server responded with {{statusCode}} code.",
dictCancelUpload: "Cancel upload",
dictCancelUploadConfirmation: "Are you sure you want to cancel this upload?",
dictRemoveFile: "Remove file",
dictRemoveFileConfirmation: null,
dictMaxFilesExceeded: "You can not upload any more files.",
No hay comentarios:
Publicar un comentario
Gracias por vuestros aportes.