Forums

How to add file accept

Yudhizth 30 Sep, 2015
Dear all,

I have file upload that only pdf file type allowed. We know that fileupload action only works on submit event.
How to add file accept on file upload chronoform on load?

Thank you
GreyHead 30 Sep, 2015
Hi Yudhizth,

Why would you want to do that - they user can't upload a file before the form loads???

Bob
Yudhizth 01 Oct, 2015
Thank you Bob,

Because we have regulation that requires only pdf file to upload, so to prevent user upload another file type, I want to do that

Yudhizth
Yudhizth 01 Oct, 2015
for clarity,

When I click fileupload button, only pdf file allowed. another filetype will cannot be selected

Thank you
GreyHead 01 Oct, 2015
Hi Yudhizth,

You can set the allowed filetypes in the Files Upload action. It might be possible to check the type before the upload if the user has an HTML5 browser but ChronoForms doesn't support that at present.

Bob
Yudhizth 01 Oct, 2015
Thank you Bob,

I've been use that action and add event loop on fail action. Ok, I think you should add this feature on the next version,

by the way,

I found little code of file accept
<input type="file" name="pic" accept=".pdf">
and the result.
GreyHead 01 Oct, 2015
Hi Yudhizth,

You can add that now in the Extra Params box of the File Field element:
accept=.pdf


Bob
Yudhizth 02 Oct, 2015
Fabulous,

Thankyou Bob 😀
This topic is locked and no more replies can be posted.