Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Create a local file on a local directory from a webapp  RSS feed

 
Natalia Lopez
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!!
I'd like to create a file and write results to that file when I press a button on a webappplication.
I want to leave the file in the user local direcroty. My code now is tring to create the file on the webserver directory.

Any Idea of how can I leave a file on the user local folder?
Regards

Naty
 
Joe Ess
Bartender
Posts: 9425
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I assume you have a servlet on your server side?
Just write the file to the ServletResponse. Have a look at this article for more on the subject.
 
Natalia Lopez
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes I'm using servlets and struts, I only need to save a file generated by the webapplication on the local user disk

Regards

Naty
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As Joe said, just send the file as the response to some request, with an appropriate content type; the user will be prompted to save the file. There's no way to save the file without user involvement.
 
Natalia Lopez
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot! I will try but my wish was to avoid user involvement!
Naty
 
Natalia Lopez
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I forget that I'm using struts !!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!