I am trying to read all the files in a directory, then dump the data into the database. It reads it fine but I can't get the $data[] to store anything. Can anyone tell me what is wrong here:
Thanks!!!Code:$directory = "./temp"; $dir = opendir($directory); while($curfile = readdir($dir)) { //Loops through all the files in the directory; if ($curfile!="." && $curfile != "..") { // don't need any directories, just files echo "$curfile<br>"; // Checker - each file name does print to the screen // problem somewhere here when trying to read the data $nowfile = $_FILES[csv][tmp_name]; $handle = fopen($nowfile,"r"); do { echo "$data[0]"; // do anything with the data } while ($data = fgetcsv($handle,1000,",",'"')); // do } // end if } // end while


Reply With Quote

Bookmarks