upload a file using gwt with out showing the file chooser,send file by picking it from default location - gwt

I'm beginner to GWT,I've a task that I need to upload a file to the server
but the constraint here is, we should not show the file chooser dialogbox.
with the given input file name we pick that file from the default file location and uploads it.
I think the requirement is clear to you..Please help me on this.
thank you

FileUpload is the widget in GWT for uploading file but you have to choose a file. follow this.
There is no way in GWT to get file in client. If you don't want to choose a file from a default location then just give a text box and read file name, then pass this file name to server and do enough processing there, you can't take File in client side.

Related

How to know whether it is File or a Directory in GWT?

How would I know that it is file or a directory , cause I have to check a condition that if it is a file then return a particular image for the files and if it is directory then return different image for that,
isDirectory() and isFile() method are not working in GWT.
Kindly give the solution for GWT.
Try to use GWT Elemental. It brings a HTML5 File API (besides WebGL, WebAudio, Shadow DOM,...), with which you should check if it is a directory or file (on client-side):
FileEntry fileEntry = (FileEntry)entry;
fileEntry.isDirectory();
fileEntry.isFile();
You should be doing such operations on the server side. You can always create a bean with the required properties which can be used on the client side.

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

Browse file and store file url for uploading it later

I have a form in which you enter some data and you are able to attach files. All I wanna do is have a Browse button so i can select the file and store that file url in some var, so later when i want to submit the form...y can read that var and upload the file using its url. Im using Scala Lift. I search for examples in the web but couldnt find anything helpful. I only want to select the file and store the file url. Can someone help me? Thanks!
You can't store path to file on client's drive. Even if you get path like this, you can't upload file that is not manually selected by client.
I suggest doing AJAX based client.

Gwt- file path when uploading the file

Here i have stucked in simple concept.How to get the file-path when uploading the file in GWT. For example-(d:/example.xls) this is my upload-file. how to get this path programmatically? i have tried this
FileUpload ff=New FileUpload();
ff.getFileName();
when i use above code.it is returning only example.xls only.. help me
You can't access this information from GWT (and javascript in general)
I think, you cannot get the absolute path of a file that you have uploaded. The path will be absent or changed to avoid security risks, after you have done the upload.
You can get the file's name using the getFileName() function,
and even its content, with the HTML5 FileAPI.

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