Browse for file to use in packaged Chrome Web App
How do I access a file chosen by the user from the filesystem in a (packaged) Chrome Web App?
I am writing an开发者_JAVA技巧 image manipulator app, and need to draw the contents of a selected file in a <canvas>
element.
Is this possible, and if so, how?
If you want to access Chrome's file system APIs, you first need to add permissions in the manifest. Just add "fileSystem" (with the quotes) to the permissions list.
To select the file, you can use drag-n-drop (read in the link above) or the supercommon file chooser (with an <input type="file">
).
Also, you can load an image into a canvas with canvas.drawImage. Is that simple, just set the image path, type x and y coordinates of the image and you're ready to go!
P. S.: Sorry by answering too late! I've just seen the post... :/
精彩评论