• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

How to read file in php?

I am running Apache server with php 4.0

This is the function of reading file.
I can read file when the file is in the computer of the server. If a client access the readfile function, it only know to search for the file in the server, but it suppose to read the file that is in client's computer. Therefore, when $TheFile is the path of file refer to client computer, there is warning message that "No such file or directory"

Does anyone know how to code in order to read the file in client's computer ??

function ReadFromFile($TheFile)
{

$Open = fopen ($TheFile, "r");

if($Open){
$Data = file ("$TheFile");
fclose($Open);
}
else{
print ("Unable to read from $TheFile!
\n");
}
return $Data;
}
 
😕

Okay I'm trying to learn PHP and everything, but I suck .. so i can't answer your question. You are in the wrong forum though, this should be in the software/programming forum, you'll get better help there. 🙂
 
You can't arbitrarily read any file on a client's machine. You can set up a script that allows a user to upload a file though. Alternatively, you can have them paste over the contents of the file and sent it via a post form.
 
Back
Top