Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

php search file contents

Status
Not open for further replies.

birdieserver

Programmer
Aug 3, 2005
3
GB
hi, ive made a script which searches a files contents for certain words.. for some reason, the file_contents function doesnt work

//sets vars
$files = $_POST['file'];
$h = file_get_contents("$files");

can you tell me why this doesnt work please?
 
of course it does not work.
You will need to use this:

$files = $_FILES["file"]["tmp_name"];
or
$files = $_FILES["file"];
$h = file_get_contents($files);

And in your form tag you will need to have this:

enctype="multipart/form-data
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top