I have feature that exports and generates csv using opencsv in vaadin 7. The problem I have is how to get a file location to save a file on users local machine.
Below is a line that needs a path to where to save a generated file.
CSVWriter writer = new CSVWriter(new FileWriter("H:\\dummy\\export"+timestamp+".csv"));
Instead of having a static file path, I need to prompt the user for where to save a file, as well as how the user wants to name a file.
I appreciate your help.
You have no chance to influence the location of a file that a user downloads.
Here you can find a sample how to create a download with vaadin:
Letting The User Download A File
Note: The Vaadin7 Link broke, this is for Vaadin8 but still helpful.
Related
I have core data file generated by my app. This file contains a data. But I don't want this file generate in every user device. I want put this file in app and every user uses this file. How can I do this?
I have find answer here:
https://gist.github.com/xavierchia/ef43abb270003ae63e5bbb7eb5404645
I need just copy my SQL files to project and copy them in app directory.
I have an app in which the user should be able to get a txt file from there external storage in order to upload to firebase_storage. The thing is, I don't know the path of the file, so I want the user to be able to choose this like they would be able to choose a pdf using file_picker or pick an image using image_picker? How would I be able to do this?
I figured out that I can use the flutter_document_picker and specify in that that I want a txt file for the device to get.
I want to write a small app that does some data manipulation on the contents of a simple text file.
I just want to be able to right click such a file, choose 'Open with' in Windows, select my app, then the app opens, parses the file, does some stuff and closes immediately again.
Question: when my app starts, how do I get the file name that triggered the app to start?
Thanks!
You get the file as parameter number 1.
You can get it with the function ParamStr(1).
Have a look here for more details:
http://www.delphibasics.co.uk/RTL.asp?Name=ParamStr
For your information, ParamStr(0) is the filename (including complete path) of your EXE application.
I have a one script file in my current application.. The path for same look like this.
D:\myproj\Example\www\abc.js
while running my application in device it will download one file into my SDcard dynamically.
I need to parse my downloaded application and need to set this "abc.js" file path in this.
I can able to set path if my file is in SDCard , but dont know how to refer path which is in my current application..
If you have that file on SDCard, then the full path to it will be as follows:
file:///SDCard/myproj/Example/www/abc.js
ADDITIONAL INFO:
If your file is located in cod file, then there is a way, but it is not documented and it is not guaranteed that it will work on all devices and RIM OS versions.
Code below shows document.htm encapsulated in modulename.cod in BlackBerry browser.
BrowserSession session = Browser.getDefaultSession();
session.displayPage("cod://modulename/document.htm" );
Try to use cod://modulename/abc.js to specify path to your js file.
To reference an application embedded file (in this case an image file stored in images directory):
"file:///local/images/embedded_img.png"
This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
How can I use Delphi to test if a Directory is writeable?
My program will download an update for the user if they request it. The user has to specify the location to save the installer. They might pick a directory which they don't have access to save something to. In this case the download starts (downloading to a temporary directory I assume) and we only know that it failed when it ends and tries to move the file into the folder.
Is there a simple way to check if we have write permissions on a folder in Delhi?
There is AccessCheck function or tricks, but this information is not reliable in generic case.
So, usually you just need to create file to check, if you have access for that.
For your specific case, you have the following choices:
After save dialog closing: try to
create a file in target folder with
the name of downloading file. Delete
it after check. Not pretty, since
you rarely may have access to create
files, but not to delete them.
After save dialog closing: try to create a
file in target folder with the name
of downloading file. Keep that
handle open and move file content to
it after download is complete. Not
pretty, since you can't move file,
you need to copy it.
(the right one?) Just bring save dialog again
on any access denied issues.