GWT FileUpload get File Full Path - gwt

our Boss wants us to build a client only GWT App. so no server side coding will be involved in our GWT app.
Now we use a FileUpload widget to select a file from user file-system. most Browsers -for security reasons- don't allow FileUpload to return the full path of selected file. a real problem for us!
Is there a way, client-side, to fetch the filepath from a FileUpload widget?
any clever workaround or any other GWT widget that enables user file selection and returns selected file full path in file-system?
thanks.

You cannot get the full path of a selected file of an input element. The path will be absent or changed to avoid security risks in almost every browser browser.
You can get the file's name, and even its content, with the HTML5 FileAPI.

Related

How can I create save destination chooser of file with GWT?

I want to enhance this question. How can I create File Destination Chooser (as like JFileChooser) in GWT?
I had googled for a long time to get it in GWT. I found GWT FileUpload in most.
Any Suggestions for it ?
UPDATE: After clearing on question
Well, for this you would need a Download Servlet for the file. There in HttpServletResponse you will fill the content with the file and header with file types and all.
And from your client side call the URL.
For prompting case, it depends upon the browser configuration. You cannot force browser to open location prompt.
For achieving download only, you can refer to download file using gwt

how to show a file chooser dialog in GWT with server-side file system?

I have a GWT application, which needs to be configured before it can be used by clients.
I want to show some "perform initial configuration" page and let user select some folder to keep the data in.
now, how do I show a file chooser in the GWT client side which would contain the file system of the server?
I could theoretically implement such a widget myself - read all the files server-side, provide a list to the client, etc, etc. but this looks like a pretty common requirement, so I suspect such a widget should already exist...
GWT does not have an out-of-the-box widget+servlet doing that, and I dont know any 3party library doing that (but maybe you have some success searching in the web).
So you have to create a service in server side to provide the info (folders and files list). In client side I would use a CellTree which is very appropriate to display a filesystem structure.

How GWT fileupload works?

Anybody know how GWT file upload works? I know about FileUpload widget and how to use it. I want to know what is its inner mechanism. We can't get contents of file from FileUpload widget in client and how it is going to server? I googled it but i didn't get solution.
Thanks in advance.
GWT's file upload makes use HTML's input element. The html input element is native html dom element which allows to select files from your system.
After selection you need to submit it to your server. This is done by the GWT's FormPanel.
In particular, FileUpload is only useful when used within a FormPanel, because the browser will only upload files using form submission.
Note:
1) You can read about how to code with formpanel and fileupload as answered here # Basic File upload in GWT
2) If you are concerned with processing the file on client side and not pushing the file to server then you have limited options as mentioned here # How to retrieve file from GWT FileUpload component?
formPanel.setAction(GWT.getModuleBaseURL()+"uploadHandler");
formPanel.setMethod(Method.POST);
when we use formPanel.submit(),we can invoke the servlet and get the file upload details.

GWT Browse files/directories

Here is my requirement:
In my application, I want to get a path of file from user and process the file accordingly.
I am providing a text box in which user can directly enter the path.
Or user can opt to choose a file by clicking on Browse button and selecting a file.
Which widget shall I use to browse local files and directories?
I found one widget called FileUpload but whenever I get the fileName by fileUpload.getFileName, it does not give me the whole path.
You don't need the whole path.
Please see the links below.
The first link covers the client side and the second one the servlet side.
http://gwt.google.com/samples/Showcase/Showcase.html#!CwFileUpload
http://commons.apache.org/fileupload/using.html

viewing autocomplete.do files

i was trying to reverse engineer a website ("www.asklaila.com") to find out how their yahoo UI AutoComplete Widget is working. Upon finding the view source of it, i saw it is refering to a file called "/autocomplete.do", i wanted to know what does this autocomplete.do file mean and can i download and open it locally on my machine?
Hope my requisite is legitimate and ethical.
As explained by FileInfo.com, the .do extension represents a server side Java code file that runs on the server and outputs HTML to the response.
Therefore, you cannot download it and view its contents. Any requests to the file will either return the same HTML or an HTTP error if it requires parameters/form fields.