JQuery File Upload preview File Type to allow all file types

女生的网名这么多〃 提交于 2019-12-24 14:04:09

问题


I am trying to preview different file types, but Its not working. By default jQuery File upload only previews Image files(jpeg | png | gif). But I need to display a preview for Other File types such as (pdf | doc | pptx | txt). How to achive this?? I tried changing this, but no luck

Existing Code:

previewFileTypes: /^image\/(gif|jpeg|png)$/,

My Change: (Still does not show preview for pdf, doc, ppt)

previewFileTypes: /^.*\/(gif|jpeg|png|pdf|PDF|pptx|plain|doc|docx)$/,

回答1:


The preview is for showing images. The PDF and document file types are not images, and cannot be shown. From the documentation:

Preview images, audio and video: A preview of image, audio and video files can be displayed before uploading with browsers supporting the required APIs.



来源:https://stackoverflow.com/questions/18002688/jquery-file-upload-preview-file-type-to-allow-all-file-types

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!