1. Can I upload an image to a document library using javascript?
  2. Can I use that information together with, for example, clipboardData?

The solution does not have to be cross-browser (it's enough if it only works in Chrome, for example)

What I'm aiming at is that a content manager could paste a screenshot to a SharePoint wiki page using CTRL+V, javascript would notice the event, show a dialog asking for the file name, and when user has entered the filename read the file from clipboard, upload it to the default document library (specified somewhere) and create an img tag pointing to the file. From now on the user could interact with the image using oob SharePoint. An example of pasting a screenshot to a html page using Chrome is here: http://strd6.com/2011/09/html5-javascript-pasting-image-data-in-chrome/ (just paste a screenshot to that page).

Would there be some problems preventing this? (like, do SharePoint file upload APIs support the file formats clipboardData provides, or would there be some other showstoppers?)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.