On Mon, Dec 15, 2008 at 8:31 PM, Chris Prince <[email protected]> wrote: > > Comments inline. > >> Sorry for not being clearer. I would like to show a preview of the >> image before uploading the file via HttpRequest. > > Ah, okay. > >> I've tried all sorts of variants for the definition of show_updates() >> function, but I can't get an image to appear. As I read the docs, >> previewUrl should be the "url" inside in the store. But, I can't seem >> to get the data back out. A simple example for show_updates is: >> >> function show_update(file, previewUrl) >> { >> $('img_queue').append("<div><img src=\"" + previewUrl +"\"><"+"/ >> div>"); >> } >> >> But this doesn't show the image. In fact, nothing is shown. >> >> The storage seems to work properly - that is, there are no exceptions >> thown. However, i just can't get my data back out. > > Is the content not being served, or is your DOM manipulation failing? > What happens if you manually navigate to the URL stored in > 'previewUrl'? >
Or is the <img> tag refusing to display image data due the lack of a content-type header? If so, the captureBlob takes an optional third argument to specify the content-type header value. Something else that could cause this fail in the wild is incorporating the file name into the previewUrl. Spaces and other characters allowed by the filesystem you're running on may not be valid in urls. > --Chris >
