I don't know how to do this myself, but I do know that the stock photo Javascript code does something like this. After looking at a bunch of images in stock photo, you end up with a bunch of JPEG files on your hard disk that all came from the web. Since I think stockphoto is written entirely in web HTML, JavaScript and BridgeScript, I presume this can be done somehow (getting a file from the web onto your hard disk).
My suggestion would be to try to figure out how stock photo does it by looking at it's javascript code. But, be warned the stock photo code is not simple to follow.
--John