Hi.

I need open some text file and insert it to some array. Can someone help me with this ?

Comments

ibragim’s picture

use php function:
fopen()
fget()
file()...

$filename = "/usr/local/something.txt";
$handle = fopen($filename, "r");
$contents = fread($handle, filesize($filename));
fclose($handle);
pilarjakub’s picture

its good, but i need use some input type=file to get path to file, when i use it like :

<form name='pridat' action='' method='post'>

      <input type='file' name='soubor_dat' /><br /> <br />

      <input type='submit' value='Odeslat' />  </form>";

if (isset($_POST[soubor_dat])){
if (!($_POST[soubor_dat] == '') ){
$f=$_POST[soubor_dat];

$f is now just name of file, but not path ... and then i cant open it by fopen, can you say me someelse possibility to get path ?