Recently writing interface ———— about image upload
The foreground uses the Vuejs, uses the base64 to upload the picture, filedata: "Data:image/jpeg;base64,9j/4aaqsk ...", puts this data directly in the address bar, also can display the picture, But
Javascript and dataurlblob that are mutually converted between DataURL and File, Blob, and canvas objectsConvert canvas to dataURL (get dataURL from canvas)
var dataurl = canvas.toDataURL('image/png');Convert File objects to dataURL and Blob objects
Canvas converted to Dataurl (get dataurl from canvas)var dataurl = canvas.toDataURL(‘image/png‘);Convert file object to Dataurl, Blob object to DataurlThe file object is also a Blob object, with the same processing.function readBlobAsDataURL(blob,
JavaScript converts a base64 image to formData and submits it through AJAX.
Previously, we used the webcam plug-in to take a photo. After taking the photo, we got an image in base64 format. It's okay to directly display it. Just specify it in src,
Why?
Users do not need to download images and then upload them through input file;
The chrome plug-in can directly right-click the image on the page and upload the image directly;
All to increase user experience!
Ideas
Request an image through
In order to take photos of the use of webcam-related plug-ins, its shooting is the base64 format of the picture, direct display no problem, in the SRC directly specified on it, but to upload to the server when the problem comes, the server side
44336477Https://www.cnblogs.com/hhhyaaon/p/5928152.htmlHttps://developer.mozilla.org/zh-CN/docs/Web/API/File/Using_files_from_web_applicationsSolve the following problems:
How to beautify the form of input upload file: Make input form hidden,
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.