I want to give the user possibility to paste an image into a webform. I don't need to display the image, all I need is the image's location.
I know it's possible because the guys at CKEditor(and other editors) are doing it.
If you go here, http://ckeditor.com/demo and paste an image you copied and then right click on it and go to image properties you'll see they have the image's address.
How can this be do开发者_Go百科ne?
Thanks
It is not possible because giving a browser the possibility to access local files, which have not been added to be uploaded explicitly by the user, opens a variety of very dangerous security holes that would certainly be super-exploited by hackers.
A good solution would be to give the posibility to upload using Ajax and link the images in the document once they are available in the server.
Take a look at “Sending files using a FormData object” part of the Using XMLHttpRequest document at Mozilla Developer Network.
精彩评论