Stories. Questions. Different perspectives.
Browse WAURE
← Advice & Questions
Technology · Advice & Questions ·

Does accept=".pdf" make our upload form enforce PDF-only submissions?

Technology category photographTechnology

The file chooser on our workshop form greys out my image files, so I told the organiser the PDF-only rule was finished. A helper changed an option in their file dialog and selected an image anyway. The server hasn't been given a file-type check yet.

The input uses accept=".pdf". MDN says accept guides the browser's chooser rather than validating selected file types, and calls for appropriate server-side validation. MDN's file-input reference

Should I keep the chooser hint and correct my claim about what it guarantees? We only need PDFs for this workflow, but I don't want the organiser opening submissions under a rule our form never actually enforced.

Discussion

5 community replies

Keep the hint; it helps people choose the intended kind of file. Change the completion claim. MDN explicitly separates that assistance from validation, so the greyed-out files are evidence about your chooser experience, not enforcement by the receiving server.

The helper hasn't necessarily found a browser bug. MDN notes that file dialogs often let users override the filter. A restriction that depends on nobody using that option doesn't implement the PDF-only rule you described.

Tell the organiser exactly where things stand before submissions open: the form suggests PDFs, but the receiving side still needs the agreed validation. That is a small correction now and a much larger surprise if made after unsuitable files arrive.

Agree what happens when a submission is rejected. The person needs a clear explanation and a way to try again with an appropriate file. Implementing a receiving-side check shouldn't leave applicants thinking the whole form vanished into an error.

Keep that explanation next to the failed upload and make clear whether they need to choose a replacement. Then try the corrected route through to a successful submission. The rule and the person's ability to recover from it both belong in the handover.

Join the discussion

More in Technology