My application imports a delimited data file. The first line contains the field headings. Subsequent lines contain the data that coorisponds to the field name. The files are very large and I don't have any control over how they are created.
Module 1 has the user browse to the data file on the client computer that he wants to upload.
Module 2 Opens the file for reading and reads the first line.
The user takes several minutes (or hours) selecting which fields to import into the database. Once the selections have been made, they are posted and passed to a third module which opens the file again and reads the entire file (discarding line 1) and inserting remaining lines into a MySQL database.
I need a way to remember the client-side file spec (path and file) so that I can open it again in the third module without having the user browse to it again. This information doesn't appear to be stored in the $_FILES array.
<FORM ENCTYPE="multipart/form-data" ACTION="Import.php" METHOD="POST">
<P>File name: <INPUT TYPE="FILE" NAME="UploadFile" />
<INPUT TYPE='hidden' NAME='bgcolor' VALUE='<? echo $bgcolor; ?>' >
<INPUT TYPE='submit' VALUE='Submit'>
$fp = fopen($fcb['tmp_name'], 'r');
$rec = fgets($fp);
$res = fclose($fp);
$fields = explode(",", $rec);
*/ A form allows user to assign field intents and posts user choices*/
Retrieves posted field assignment information, Opens the datafile for reading, and inserts the contents into the database.