erigunwijfni
erigunwijfni

Reputation: 11

PHP file input, accessing the content of the file

I am making a file input that takes in a txt file. How do I access the contents of the file that just got uploaded using PHP?

Upvotes: 1

Views: 126

Answers (2)

Chris Forrette
Chris Forrette

Reputation: 3214

If you want to access the file directly:

$content = file_get_contents($_FILES["file_input_field_name"]["tmp_name"]);

If you want to store the file, you'll want to check out:

http://php.net/move_uploaded_file

Upvotes: 2

zerkms
zerkms

Reputation: 254916

$contents = file_get_contents('/path/to/file');

Upvotes: 2

Related Questions