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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T19:09:09+00:00 2026-06-05T19:09:09+00:00

I have a txt file that is generated on the server and contains newlines.

  • 0

I have a txt file that is generated on the server and contains newlines. If I view the file in my ftp editor, they are here. If I download it through my ftp client and open in it windows with notepad, I also see the newlines.

But when I try to download it through the browser by forcing a download window, and then open the file, all the new lines are suddenly gone.

This is the code I have now. I also tried to set the content type to application/force-download, but that also made no difference.

header('Content-Type: text/plain');
header('Content-Disposition: attachment; filename="'.$myFile.'"');
header("Content-Transfer-Encoding: binary");

Any idea why the new lines are only missing when I download it through the browser? But are intact when I view the file on the server, or download it from the ftp and the open in notepad?

  • 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-05T19:09:11+00:00Added an answer on June 5, 2026 at 7:09 pm

    Unix line endings (\n) are different than Windows line endings (\r\n). Many FTP programs have an option to automatically convert line endings between operating systems; your browser is not doing this (The browser won’t touch text/plain.)

    If you want to be double-sure, you could hexdump the file and look at where a newline ought to be.

    Try opening the file with wordpad or notepad++, which respect \n as line endings. Notepad is one of the few tools that still requires \r\n line endings.

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

Sidebar

Related Questions

I have a .txt file that contains a list of names and some numbers.
I have a blacklist.txt file that contains keywords I want to remove using sed.
I have a generated txt file. This file has certain lines that are superfluous,
I have a CMakeLists.txt that produces a .SLN file with 3 projects (libraries) generated
I have a txt file that created in notepad , containing these lines for
I have a txt file that include information as follow: Jack Jim Bill's Father
For example, I have a txt file that reads: 12 345 45 2342 234
I have a CMakeLists.txt file that looks like this: add_executable(exec1 exec1.c source1.c source2.c source3.c)
I have a ID.txt file that looks like this: http://something.net/something-ak/41389_718783565_1214898307_q.jpg http://something.net/something-ak/372142_106502518141813_1189943482_q.jpg and so on
What I have is a txt file that is huge, 60MB. I need to

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.