Currently, all the preferences, user input, and progress on file uploads into the database are saved in PHP Session variables tied to whoever's web browser is doing the upload. Problem is that these Sessions are temporary. If the server times out, user's power dies, user closes the window, etc. during an upload, the settings are lost, the file is only half-uploaded, and must be restarted *from the beginning* later.
It would be preferable to store all these user-inputted settings into a MySQL table of "Uploads In Progress," keyed by the name of the file being uploaded. That way, the final Upload step (importing data) would only need a single Superglobal variable: $_GET['filename']. Since it's a GET, PHP Sessions can die or servers can time out, and the upload can always be resumed where it left off by refreshing the "importing data" page. This would find the DB Table row keyed by the given filename and be able to read everything it needs to continue loading where it left off. Or, administration.php could list uploads in progress for easy resume at a later date. Or, you could even run cron jobs on the entries in that table.
Some things the DB would store for uploads in progress:
- filename
- line number (maybe not written after every row is read, but use checkpoints)
- the User/Admin performing the upload
- Anything else currently stored in $_SESSION['upload'] (use serialize() for arrays)
It may be acceptable to continue to use SESSION variables for the upload (to avoid always going to MySQL for information), as long as the DB would serve as a relatively up-to-date backup.