Why this accepted answer doesn't work for me?
Automatically submitting a form when an upload file is chosen
my code:
<form>
<input id="id_image" name="image" onchange="this.form.submit();" type="file">
<input id="send" type="submit" value="submit" name="submit">
</form>
Because you named your second input "submit"
, which shadows the submit
method of the form. Rename it.
For example :
<form>
<input id="id_image" name="image" onchange="this.form.submit();" type="file">
<input id="send" type="submit" value="submit" name="somename">
</form>
The solution is simple :D
<form>
<input id="id_image" name="image" onchange="this.form.submit();" type="file">
<input id="send" type="submit" value="submit" name="submit2">
</form>
The code it's ok, but you call the input button with submit..:D
Change the name and it's ok!
Hope this Help! Bye.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.