Limit file format when using <input type=“file”>?

前端 未结 11 2243
盖世英雄少女心
盖世英雄少女心 2020-11-22 04:15

I\'d like to restrict the type of file that can be chosen from the native OS file chooser when the user clicks the Browse button in the

11条回答
  •  再見小時候
    2020-11-22 05:08

    You could actually do it with javascript but remember js is client side, so you would actually be "warning users" what type of files they can upload, if you want to AVOID (restrict or limit as you said) certain type of files you MUST do it server side.

    Look at this basic tut if you would like to get started with server side validation. For the whole tutorial visit this page.

    Good luck!

提交回复
热议问题