Skip to content Skip to sidebar Skip to footer

Handling File Uploads When A Property Is Added From The Javascript File Object

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

Solution 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);

Post a Comment for "Handling File Uploads When A Property Is Added From The Javascript File Object"