file upload (restrict the upload file types to PDF only) using cq xtypes/widgets | Community
Skip to main content
sreedobe
Level 4
November 3, 2015
Solved

file upload (restrict the upload file types to PDF only) using cq xtypes/widgets

  • November 3, 2015
  • 4 replies
  • 2860 views

Hello All,

I need to write a component that does **file upload (restrict the upload file types to PDF only).**

I have seen CQ has its own dialogs to upload files, but I am not sure, whether I could resuse them.

Please let me know, if I could use out of the box xtypes "smartfile",
"fileuploadfield", "html5fileuploadfield", or "uploaddialogbutton"
with restriction to PDF files.
 
OR  Do I need to write custom component extending one of the xtypes?

I appreciate all the help.

Thank you,
Sri

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by kautuk_sahni

Hi

Extending to what Scott has mentioned in reply,

You can create a custom uploading component, there you can write a logic to handling a particular type of extension that you would love to upload.

Some facts about PDF, 

1. If you open PDF file in text pad or notepad, it will always start with "%PDF-<version>", so even if you don't want to check mine type or something, just read a line of file, and check if it is of "%PDF-<version>".

Link:- https://helpx.adobe.com/experience-manager/using/uploading-files-aem1.html

I hope this would act as some help to you.

 

Thanks and Regards

Kautuk Sahni

4 replies

edubey
Level 10
November 3, 2015

you can use ddAccept property. define the MIME type of file which you want to allowed

Documentation

sreedobe
sreedobeAuthor
Level 4
November 4, 2015

edubey wrote...

you can use ddAccept property. define the MIME type of file which you want to allowed

Documentation

 

Thank you. ddAccept only works for drag and drop, for upload "mimeType" property works.

Either way, I could not use these OOTB components,as I need to have server side processing to store the files at a specific content dam location.

smacdonald2008
Level 10
November 4, 2015
kautuk_sahni
Community Manager
kautuk_sahniCommunity ManagerAccepted solution
Community Manager
November 4, 2015

Hi

Extending to what Scott has mentioned in reply,

You can create a custom uploading component, there you can write a logic to handling a particular type of extension that you would love to upload.

Some facts about PDF, 

1. If you open PDF file in text pad or notepad, it will always start with "%PDF-<version>", so even if you don't want to check mine type or something, just read a line of file, and check if it is of "%PDF-<version>".

Link:- https://helpx.adobe.com/experience-manager/using/uploading-files-aem1.html

I hope this would act as some help to you.

 

Thanks and Regards

Kautuk Sahni

Kautuk Sahni