I want to split huge files (to be specific, tar.gz files) in multiple part from php code. Main reason to do this is, php\'s 2gb limit on 32bit system.
SO I want to s
HJSPLIT
http://www.hjsplit.org/php/
My comment was voted up twice, so maybe my guess was onto something :P
If on a unix environment, try this...
exec('split -d -b 2048m file.tar.gz pieces');
split
Your pieces should be pieces1
, pieces2
, etc.
You could get the number of resulting pieces easily by using stat()
in PHP to get the file size and then do the simple math (int) ($stat['size'] / 2048*1024*1024)
(I think).
This would probably be possible in php, but php was built for web development and trying to this whole operation in one request will result in the request timing out.
You could however use another language like java or c# and build a background process that you can notify from php to perform the operation. Or even run from php, depending on your Security settings on the host.