The input problem of uploading files and the FormData feature

1. In addition to type="file", add name="file" to the input, otherwise $_FILES is empty, and the name value of the input is to distinguish each input

2.var formdata = new FormData($("#form")[0]); 或者var formdata = new FormData(document.getElementById("form"));

$("#form")[0] represents the form object.

FormData() represents the information in the entire form, packaged into an object, if you need to add object properties (get parameters)

formdata.append('gid',data);

3.array_keys() returns an array of key names

 

1. In addition to type="file", add name="file" to the input, otherwise $_FILES is empty, and the name value of the input is to distinguish each input

2.var formdata = new FormData($("#form")[0]); 或者var formdata = new FormData(document.getElementById("form"));

$("#form")[0] represents the form object.

FormData() represents the information in the entire form, packaged into an object, if you need to add object properties (get parameters)

formdata.append('gid',data);

3.array_keys() returns an array of key names

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324895108&siteId=291194637