Element-ui upload problem

the picture is the absolute address of the local storage obtained after being photographed by the connected device. How to use upload upload
to place the picture directly in the file-list, and the status automatically changes to success. Unable to upload.

take a closer look at the data and compare the array structure after selecting the picture.
by selecting a picture:

{
name: "2-1406091109422c.jpg"
percentage: 0
raw: File(348934)
    lastModified: 1530602084907
    lastModifiedDate: Tue Jul 03 2018 15:14:44 GMT+0800 () {}
    name: "2-1406091109422c.jpg"
    size: 348934
    type: "image/jpeg"
    uid: 1542613909039
    webkitRelativePath: ""
    __proto__: File
size: 348934
status: "ready"
uid: 1542613909039
}

data assigned to file-list after shooting by the device (this data is transferred from base64 to file):

{
name: "123.png"
raw: File(106239)
    lastModified: 1542614011207
    lastModifiedDate: Mon Nov 19 2018 15:53:31 GMT+0800 () {}
    name: "123.png"
    size: 106239
    type: "image/jpg"
    webkitRelativePath: ""
    __proto__: File
status: "ready"
uid: 1542614011293
}

decide to convert the locally acquired images (base64) into file objects and put them into file-list but submit them to the past. If there is no uid parameter in the file object, an error will be reported when uploading (uid is automatically generated).

I don"t know how to do it, and the worst result is to write another file and upload it.

Nov.26,2021

Hello, has this problem been solved?


my final solution is that the device takes pictures and transfers them to blob through ajax form file submission and uploads. Upload without element-ui. Do it again in your spare time. I've been using it all the time before I finished it. I don't have time to change it.


just check that the upload component is automatically navigated by success. After looking at the source code, there is an item.status = item.status | | 'success'
so you can set status to non-success before assigning a value to fileList.

Menu