layerssss / paste.js

read image/text data from clipboard (cross-browser)
http://layerssss.github.io/paste.js/
MIT License
463 stars 94 forks source link

pasted image's filename #65

Closed leviwheatcroft closed 6 years ago

leviwheatcroft commented 6 years ago

Is there any way to get the pasted image's filename ?

Seems like there must be some way to do this, as I've seen apps like slack show an image's filename when pasted.

I thought it might be in the image's exif data, but that doesn't seem to be the case.

xiaoSS-developer commented 6 years ago

I thought, this is a paste of pictures from the clipboard, which is only a temporary file flow. Do not have a file name in this form?

leviwheatcroft commented 6 years ago

I understand what you're saying, but how do other js apps get filenames from pasted images ?

miladd3 commented 6 years ago

you can get file name like this but copied images from browser and so doesn't have a name

            $('textarea').one('pasteImage', function (ev, data) {
                var fileName = data.name;
            }).on('pasteImageError', function (ev, data) {
                throw "error on pasting image";
            })
leviwheatcroft commented 6 years ago

I eventually realised that the "other js apps" I was thinking of (like slack.com) don't get a filename when, as others have said, there is no "file" to have a name. Instead, they just make up a name like "Image.jpg"