Click to See Complete Forum and Search --> : download the data to client pc
dshah
09-07-2003, 11:12 PM
Can I use any HTML tag or javascript to download some data to the client machine (.csv file)?
The data is not coming from the server so windows.location.href did not help me.
What I want to do is there is some data shown to the user when user accesses the page. I want to put a download button on the page to allow users to save the data in CSV format on client machine.
Is it possibe? How?
Any help will be appreciated.
Thanks
deven
If the data is not comming from the server,
then I assume the user is inputting the data themselve?
To save on the client computer requires the users permission.
dshah
09-08-2003, 10:13 AM
Thanks Fang,
The button I am providing will allow the user to confirm that the user wants to save the data on their PC in CSV format.
any idea?
Thanks
DSHAH
Have a look here (http://forums.webdeveloper.com/showthread.php?s=&threadid=14036&highlight=save+file), it's IE only.
If you want to do this for all browsers you'll need a server side solution.
dshah
09-08-2003, 01:15 PM
Fang,
Here is what I intend to do and please let me know if it can be done in a standard way w/o depending on browser type.
I am showing data in a HTML page in a tabular fashion.
I want to allow the users to save the same data in csv format. Is there a way when I can open standard dialog box (both IE and NN) to save the contents of a frame/document/view source etc?
Thanks
deven
So the information is on the server. You can embed a link to a txt file (csv), which can be downloaded by any browser.
dshah
09-08-2003, 02:42 PM
Hi Fang,
The data is coming from the server but it is not a file. I am pulling the data from database and generating a HTML document which web server shows to the client browser. The page I am rendering to the client browser has Download button. Once the button is pressed I want the same dialog box to open up when you access txt/csv file on the web server and save the data in csv format on client PC.
Once again, as there is no file on the server, how do I allos the user to save the data in csv format? I can always show the file in csv format but it would look ugly to them.
Is there any method which allows to view the source of html page in notepad? I can then call that method.
Thanks
deven
Generate a csv file from the database and add a link on the html page to download the csv file.