Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread Saving a file to desktop?
Thu, May 10 2012 9:33 AMPermanent Link

Matthew Jones

I just realised a possible flaw in my application - can I even attempt to save a
file to disk? I'm downloading a CSV and showing it in a grid. Once sorted, I want
people to be able to save the results to file. Is that even possible in a
JavaScript browser app? If not, what might I have to do to make it happen? I'm
using the RemObjects SDK server, which has the JSON API and can also serve files
from a directory. Can I tell the parent browser to download from a custom URL?

/Matthew Jones/
Fri, May 11 2012 12:56 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Matthew,

<< I just realised a possible flaw in my application - can I even attempt to
save a file to disk? I'm downloading a CSV and showing it in a grid. Once
sorted, I want people to be able to save the results to file. Is that even
possible in a JavaScript browser app? >>

Yes, you can use the HTML5 local storage to do so, but there are limits to
how much data you can store locally and the file system stuff is only
available in certain browsers:

http://www.html5rocks.com/en/tutorials/file/filesystem/

If you'd like to play with the simple local storage functionality, I've
already got a request from Ron Levy for this and it's been sitting there
gathering dust, so I need to implement it in the TApplication class anyways
(actually, I just need to pop the code that he gave me into the WebDOM
unit).

<< If not, what might I have to do to make it happen? I'm using the
RemObjects SDK server, which has the JSON API and can also serve files from
a directory. Can I tell the parent browser to download from a custom URL? >>

Sure, you just need to have some way of dealing with the file when it comes
over.  This is easy for text files, you can just look at the
TServerRequest.ResponseContent property:

http://www.elevatesoft.com/manual?action=viewcomp&id=ewb1&comp=TServerRequest

(sorry for the empty docs)

Tim Young
Elevate Software
www.elevatesoft.com
Mon, May 28 2012 12:52 PMPermanent Link

Matthew Jones

For completeness (not expecting a response from Tim or anyone), I got around this
by using the TLink component on the form. This then allows the browser to make the
connection and save the file using the normal "save as" dialog for a web server
download.

/Matthew Jones/
Image