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");
If its text file (assuming size is not that huge) usually you could read it by
If you are not sure which type of upload it was, check the request method