0👍
You’re correctly using .append
instead of .set
, but you forgot that variables should be arrays, thus their keys should be file[]
, name[]
, comment[]
and assignment_solution[]
respectively.
This way your backend will correctly recognize that they are indeed arrays.
0👍
You are appending multiple files using the same name. Only the last addition will reach your server.
You have at least 2 options:
-
Give unique names to each field. Something similar to this
formdata.append(‘file’ + i, this.$refs.assignmentFile[i].files[0]);
Notice the concatenation of file with the index variable.
-
Use the array notation for the fields’ names. This is compatible with how PHP handled POST variables.
formdata.append(‘file[]’, this.$refs.assignmentFile[i].files[0]);
Notice the square brackets in the name file[].
You need to do this for all the fields: file, name, comments.
- [Vuejs]-Is there any Way to Read 3D Pdf using Cordova/Hybrid App for tablets?
- [Vuejs]-Downloaded PDF file is broken