0

I´m making a upload function with dropzone (I'm using Laravel). But I can only upload images. This is my dropzone code:

Dropzone.options.myAwesomDropzone = {
        maxFilesize: 2,
        autoProccessQueue: false,
        acceptedFiles: "image/jpeg,image/png,image/gif",
        parallelUploads: 30,
        dictDefaultMessage: 'Sleep hier uw bestanden in, of klik op mij.'
    };

How can I make sure that pdf,docx etc. also can be uploaded?

Thanks

--EDIT--

 Dropzone.options.myAwesomDropzone = {
        maxFilesize: 2,
        autoProccessQueue: false,
        acceptedFiles: "image/jpeg,image/png,image/gif,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
        parallelUploads: 30,
        dictDefaultMessage: 'Sleep hier uw bestanden in, of klik op mij.'
    };
Jamie
  • 8,230
  • 20
  • 68
  • 155

1 Answers1

2

Add the file types you wish to allow to the acceptedFiles setting.

ceejayoz
  • 165,698
  • 38
  • 268
  • 341
  • @jamie Well, what did you try? The correct mime types for those types of files are easily Googleable. http://stackoverflow.com/questions/4212861/what-is-a-correct-mime-type-for-docx-pptx-etc has a bunch for Office. Or just take off the setting and allow any file types to be uploaded and handle validation on your server. – ceejayoz Dec 06 '15 at 19:20
  • Please see my edit. For example if I want to add word I've to do it like that? But that's not working. still telling me:"you can't upload files of this type"? – Jamie Dec 06 '15 at 19:25
  • I'd check the file's actual mime type and see if it's what you expect. Some code to do that at http://stackoverflow.com/questions/18299806/how-to-check-file-mime-type-with-javascript-before-upload – ceejayoz Dec 06 '15 at 19:26
  • I added: "application/vnd.openxmlformats-officedocument.wordprocessingml.document" now it isn't telling me:"You can't upload files of this type" anymore but: "file must be a document of type:jpg,jpeg,png,bmp" – Jamie Dec 06 '15 at 19:30