When creating a FormData object from an existing form, are filenames automatically appended and accessible?

前端 未结 1 1491
南笙
南笙 2021-01-25 07:30

Form

相关标签:
1条回答
  • 2021-01-25 08:00

    It seems the filename is automatically added (just tested in Chrome and not sure if this differs in other circumstances).

    Steps To Reproduce

    • Go to http://jsfiddle.net/rwone/vsRSf/
    • Open Network tab in Developer Tools
    • Select two images and click the button
    • View the Network tab and you will see the filenames are defined

    enter image description here

    The image information is only defined with two parameters, and not the third filename parameter:

    myFormData.append(name, file);
    

    Original fiddle based on this post:

    https://stackoverflow.com/a/21901886/1063287

    0 讨论(0)
提交回复
热议问题