Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Download text file

 
jack nick
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello there,
I need to download a text file which is created on the fly to a browser.
My Step
Take some input from the user via html
Query a database
Generate a text file
Send it to the client browser.
Am able to acheive all this. But the out put of this txt file comes on the browser itself whereas my requirements demand that this text file be stored at a user defined location open up the file browser.
Could any let me know how to overcome this situation
Regards
Jack
 
Andri G
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by jack nick:
Hello there,
I need to download a text file which is created on the fly to a browser.
My Step
Take some input from the user via html
Query a database
Generate a text file
Send it to the client browser.
Am able to acheive all this. But the out put of this txt file comes on the browser itself whereas my requirements demand that this text file be stored at a user defined location open up the file browser.
Could any let me know how to overcome this situation
Regards
Jack

 
Andri G
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[sorry for my previous mistaken reply]
Hi Jack,
In your case, it is opened by the browser because client browsers
usually register for MIME text to be opened by itself (as with some other MIME type - html, images, etc).
So I think you have to change the extension (don't use .txt)
to some type unregister to browsers so default download dialog will show up (maybe ".dat"?).
Hope this may help,
Andri
 
Jason Menard
Sheriff
Posts: 6450
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The other thing you could do is use jspSmartUpload from http://www.jspsmart.com/ . This will allow you to either download a file or a field from a database.
Jason
 
jack nick
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys will check this out. One think for certain. I did try to send in .dat file instead of a .txt containing plain text but this opens in the browser.
Bye
Jack
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic