Reputation: 1208
When I receive files via POST I get the default name
, type
, size
, tmp_name
, error
but the file I'm sending has additional information that I would like PHP to receive.
For example, above screenshot represents my file object in JavaScript. I added a property called newName
which I would also like to receive in the global $_FILES
variable in PHP, and then based on the newName property, upload the file on the newName.
Is this possible?
Upvotes: 0
Views: 396
Reputation: 1
You can set the name
property of a File
object at a new File
object
var file = new File(["abc"], "abc.txt", {type:"text/plain"});
console.log(file.name);
file = new File([file], "test", {type:file.type});
console.log(file.name);
Upvotes: 3