I have a plugin which crops my image and sends back a base64 data that looks like this: data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQ...
Question is how can I send that data to my file input field? If I do $("input#file").val(img);
where img
is my base64 string I get SecurityError: The operation is insecure.
you can not set the value of a file input field . There may be other alternatives such as setting the base 64 value to a hidden input field and then submitting the form.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.