javascript - Paste a piece of content with pictures and text. How to use js to get the picture and upload it to the server?
扔个三星炸死你2017-06-24 09:43:22
0
1
1316
You need to paste a piece of content with text and pictures, but the pictures need to be uploaded to the server separately. How to select the pictures from the pasted content. .
General idea:
Listen to onpaste event
Get the clipboard data
event.clipboardData
through the event parameter in the event callback (not supported by all browsers)Send data to the backend server through Ajax. After the backend stores the image, it returns an accessible address of the image
Visit this address to see the pictures