Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8900351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T01:05:03+00:00 2026-06-15T01:05:03+00:00

Below is the code i’ve written i’ve to download a file, Now I need

  • 0

Below is the code i’ve written i’ve to download a file,
Now I need to download the file to particular location in client system.I’ll get the path through input from the user.
I know it’s not good to mess client system but I had to do that

        //setting the content type of response
        response.setContentType("application/"+strFileType);

        response.setHeader("content-disposition","attachment; filename="+strFileName+"."+strFileType);

        //creating a file input stream object
         InputStream input = blob.getBinaryStream();

         //declaring a variable
         int i;
         while((i=input.read())!=-1)
         {
             //writing output
             printWriter.write(i);
         }

         //closing the streams
         input.close();
         printWriter.close();
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T01:05:04+00:00Added an answer on June 15, 2026 at 1:05 am

    I know it’s not good to mess client system but I had to do that ….

    Well the good news (from the user’s perspective!) is that you can’t do it. Even if you “have to”. A web browser is built specifically to stop you (the server side) from doing that kind of thing.

    The only away around this is to implement the functionality in a TRUSTED browser plugin or applet or something that the user has to specifically install on his / her machine.


    … where to use the path taken from the user and i’m programming this just like ftp but server side is a database

    The problem is that the browser has NO WAY to judge whether you are doing this for legitimate purposes … or as an attempt to clobber system / user files, plant malware or any number of other things that may be harmful to the user.

    It ain’t going to take the risk of letting you do it, and that is a GOOD THING.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

below code: def http = new HTTPBuilder( 'http://twitter.com/statuses/' ) http.get( path: 'user_timeline.json', query: [id:'httpbuilder',
Below code prompts for the input box for the file name and location. When
Below code not work, but it's work fine for jsf1.2. Now the framework is
The below code doesn't it print the value. function go(x) { alert(x.options.selectedIndex.value); //location=document.menu.student.options[document.menu.student.selectedIndex].value }
Below code is working properly now. But if I replace 'text.txt' with ' http://google.com
the below code print the biginteger to a file in decimal format ,how do
Below code is for donwnloading file from azure blob. I have problem with .docx,.xlsx
Below code checks for last item but I need to check for the second
Below code generates: Unhandled exception at 0x749ab763 in MyProgram1.exe: 0xC0000005: Access violation writing location
below code return File '' is not readable or does not exist always: $filters

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.