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 6056399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:22:19+00:00 2026-05-23T08:22:19+00:00

I am downloading file from server to local computer like this: $file = (

  • 0

I am downloading file from server to local computer like this:

$file = ( "TestFile.txt" );     
header( "Content-Type: application/octet-stream" );
header( "Accept-Ranges: bytes" );
header( "Content-Length: " . filesize( $file ) );
header( "Content-Disposition: attachment; filename=testfile.txt" );
readfile( $file );

It is working but it always save file in download folder without asking location. I want to open window like saving any document in OpenOffice/MS Word with option to choose any location on file system and create new folder option. My desired window also opears when we save as in browser window.

Hope you understand my problem. Is it possible to do this which work in all browsers/OS.

Thanks

  • 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-05-23T08:22:20+00:00Added an answer on May 23, 2026 at 8:22 am

    The specification of Content-Disposition reads that the receiving user agent should ignore any path component in filename parameter value:

    The receiving [user agent] SHOULD NOT respect any directory path information that may seem to be present in the filename parameter. The filename should be treated as a terminal component only.

    The reason for this is that it prones a security vulnerability:

    Since this memo provides a way for the sender to suggest a filename,
    a receiving [user agent] must take care that the sender’s suggested filename
    does not represent a hazard. Using UNIX as an example, some hazards
    would be:

    • Creating startup files (e.g., ".login").
    • Creating or overwriting system files (e.g., "/etc/passwd").
    • Overwriting any existing file.
    • Placing executable files into any command search path (e.g., "~/bin/more").
    • Sending the file to a pipe (e.g., "| sh").
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hi i am downloading file from server using ASIHTTPRequest in my iphone application but
I need to write a WCF method for downloading large file from server like
I am downloading a file from another server. I wish to push this file
I am downloading a file from the server/database via aspx page. When using the
Referencing my Earlier Question , regarding downloading a file from a server and handling
I am downloading a CSV file from another server as a data feed from
I had an application that was downloading a .CSV file from a password-protected website
I am using ASIHTTPRequest for downloading file from server but its giving error Failed
Before downloading a file from ftp server, I want to check it if exist
I have a Service that is downloading a file from a server. I warn

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.