In Vue, the Upload component of Iview cannot get the absolute path of local images. Is there any way to solve this problem? if I want to achieve clipping and upload, I need an absolute path.

in the Upload of Iview shown in the title, only file.name can get the file name. I tried file.path again, and the result is empty. Ask for help. How to solve the problem that I can"t get the absolute path of the local picture

there is also a small problem, which is the file in the instance in Iview Upload. The document is used in this way

clipboard.png

but if I change the file in the red box to a random one, such as fileUpload, then fileUpload.name won"t get anything, so what does file mean here? it doesn"t feel like a string. If I continue to use file.name,file from the original white to dark blue (maybe related to the theme), it points to a different point anyway, when to represent the type and when to represent the string. I also hope that some bosses can answer

by the way.

you can take the base64 of uploading pictures

const reader = new FileReader()
reader.readAsDataURL(file)
reader.onload = () => {
    const _base64 = reader.result
    console.log(_base64)
}

Preview: https://jsfiddle.net/cLre0vfd/


is passed to the backend to cut in coordinates


upload methods are different. It is commonly used to upload files to the server (or temporary space for resource storage) in the way of FormData object file stream, and the
server returns the address of the uploaded file.

iView first uploads the picture to the server, and the
server returns the uploaded address through the file upload hook function (such as: on-success), and then performs file operations

Menu