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

  • SEARCH
  • Home
  • 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 7401645
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T04:31:42+00:00 2026-05-29T04:31:42+00:00

I am using a plain text file in a PhP script. Is there any

  • 0

I am using a plain text file in a PhP script.
Is there any way to process the file in the PhP script without saving it locally? Everywhere I see simply uploading a file and saving it. I just need to pull some names off of the file and be done with it.
I have everything else working if I use a local copy of the file, so saving it, then deleting it works. I was just wondering if there was a way to skip the saving a copy and just getting that information directly.

We upload the file here.

<html>
<body>
    <form action="test.php" method="post" enctype="multipart/form-data">
        <label for="file">Filename:</label><input type="file" name="file" id="file" /> <br />
        <input type="submit" name="submit" value="Submit" />
    </form>
</body>
</html>

and in the script working with a copy of the file saved locally, I simply use

$file = fopen($_FILES['file']['name'], "r");
  • 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-29T04:31:42+00:00Added an answer on May 29, 2026 at 4:31 am

    If its text file (assuming size is not that huge) usually you could read it by

    $contents= file_get_contents($_FILES['file']['tmp_name']);
    

    If you are not sure which type of upload it was, check the request method

    if(strtolower($_SERVER['REQUEST_METHOD'])=='post')
        $contents= file_get_contents($_FILES['file']['tmp_name']);
    elseif(strtolower($_SERVER['REQUEST_METHOD'])=='put')
        $contents= file_get_contents("php://input");
    else
        $contents="";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way to extract all email addresses from a plain text using
given a plain text file, how can I do, using bash, awk, sed, etc,
I am using C# to read a ~120 MB plain-text CSV file. Initially I
I would like to encode some plain text using Ruby and the Crypt library
I am using AES 256 to encrypt/decrypt some plain text. But the algorithm uses
This is not a question about a specific framework. I am using plain php
I have a plain text journal I'm trying to format in php. I'd like
I'd like to store 0 to ~5000 IP addresses in a plain text file,
I have 2 plain text files that contain some words, like: File 1 Aarhus
I'm fairly new to php and I'm using a script that creates a function

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.