Read and access data and write file in directory

264 views
Skip to first unread message

jc

unread,
Dec 29, 2010, 2:29:01 AM12/29/10
to Google Web Toolkit
Hi,
I need to read a file and access it and write i.e i need to read a
dicom file and get dicom data. due to i am new to GWT i don't know how
to do. send me a sample code if you have. I used fileupload widget but
its show only the file name with fakepath(c:/fakepath/filename).

Jim Douglas

unread,
Dec 29, 2010, 3:30:22 AM12/29/10
to Google Web Toolkit
First, you cannot directly write a client-side file in JavaScript.
The primary design goal of the HTML file input widget is for the user
to select a file, which is then uploaded to a servlet for processing
on the server. For a high level overview of the process, search this
forum for fileupload, for example:

http://groups.google.com/group/google-web-toolkit/browse_thread/thread/cfe1a1feaa1b345d/935ce4db15ee537c

Second, the c:\fakepath\ thing is a security feature, originally
implemented in Opera and IE8, but now an official W3C standard. You
can read the background here:

http://blogs.msdn.com/b/ie/archive/2009/03/20/rtm-platform-changes.aspx
http://www.w3.org/TR/html5/number-state.html#file-upload-state

You might also want to review the File API, which allows for client-
side reading (not writing) of files selected by the user in a
fileupload widget.

http://www.w3.org/TR/FileAPI/
https://developer.mozilla.org/en/using_files_from_web_applications

If your ultimate goal is to deliver a file to the client, you'll need
to get there in a roundabout way, by making the file available for the
user to download:

http://groups.google.com/group/google-web-toolkit/browse_thread/thread/8c708ac2da186d17/ca92d9d8f78a0e19
Reply all
Reply to author
Forward
0 new messages