How do I submit a “file” input without submit button using JavaScript?

前端 未结 5 1636
栀梦
栀梦 2020-12-29 02:27

There is a way to automatically submit a form without clicking to a \"submit\" button?

I have a form with one \"file\" input. I would submit the form after the user

5条回答
  •  天命终不由人
    2020-12-29 03:16

    I don't believe you can do this. Browsers are very, very strict about what you can do to file upload fields, because of the potential for abuse. If the user accidentally selects a private file, they wouldn't want it to immediately start uploading that file to a random server.

提交回复
热议问题