不确定为什么我看起来不能更新值。我正在使用一个文件上传器,并且我需要在文件名后附加一个发票号,这样我们就不会得到重复的文件。
代码如下:
console.log(data.files[0]);
console.log(data.files[0].name);
console.log('$("#InvoiceNumber").val() =' + $("#InvoiceNumber").val() + "-" + data.files[0]['name']);
//here I try to update
data.files[0]['name'].value = $("#InvoiceNumber").val() + data.files[0]['name'];
//have also tried
// data.files[0]['name'] = $("#InvoiceNumber").val() + data.files[0]['name'];
//and
//data.files[0].name = $("#InvoiceNumber").val() + data.files[0].name;
console.log(data.files[0]);输出到控制台的结果是。

我无法更改服务器端的文件名,因为存在重复的文件名。有人知道我为什么不能更新那个值吗?谢谢
发布于 2019-03-22 07:13:16
File#name属性是只读的。你对此无能为力。
https://stackoverflow.com/questions/55290567
复制相似问题