View Full Version : Unzipping files on the server

01-02-2006, 10:52 AM
Hi, I have a problem, I will soon be recieving some very large csv files that will be zipped - VERY large, they need to be unzipped on the server and processed, ie I will upload them then the processing script will need to unzip, open and put the data into the database and I dont know where to start. I'm not looking for a complete script, as I said, I havent even seen the files yet, I just know that they will be too big to download and open manually (thats all I have been told)
Just looking for some pointers really.

01-02-2006, 11:06 AM
http://uk.php.net/zip might be a good place to start, if you have it installed/can install it.
Otherwise, exec() with 'unzip' could be an option?
Or, you could write a bash script that unzips the files at a certain time each day (before the PHP script) runs.

01-02-2006, 02:19 PM
looks like this might do thee trick:


function unzip($zip_file, $src_dir, $extract_dir)
copy($src_dir . "/" . $zip_file, $extract_dir . "/" . $zip_file);
shell_exec("unzip $zip_file");