1

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 Answer 1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for the reply, Is there anyway we could preview other file type??
Not without first uploading it to the server, and then creating an image thumbnail. The other document types don't have any sort of access to a thumbnail image, which is what the preview is.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.