FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


how to compress a file using php ?





Philip
is there a way to zip or compress a file within a folder using php ?
i need since i want to allowed my user to upload files to my site.

and how to access the file inside the zip files ?

thanks,
yjwong
Yes, there is a way you can access the files in a ZIP file. You can the ZIP file functions in the PHP extension php_zip. I don't know if Frihost has this extension enabled or not, but more information can be found here: http://www.php.net/zip. However, I do not like these functions very much. Perhaps a better one can be found here.
kv
Here is a nice utility. Can create/extract tar/gzip/bzip2/zip archives.
Philip
i hear that there is a compresser that can compress until 98%, like 500 Mega to 5 Mega, but it need more than a day for compressing anda decompressing, i wonder is there a compresser like that ? if not what good compressor on php ?

thanks,
krazycapital
I found a really good one:
http://www.phpconcept.net/pclzip/
kv
Philip wrote:
i hear that there is a compresser that can compress until 98%, like 500 Mega to 5 Mega, but it need more than a day for compressing anda decompressing, i wonder is there a compresser like that ? if not what good compressor on php ?

thanks,


I don't think that is true. All the compressions depend on mathematical algorithms to represent a bigger set as a smaller set from which you could derive the bigger set unambiguously. There will be a limit after which this compression will have no effect.
Philip
i see, i get it
thanks for the info Smile

er.. what the main reason that make a file when download can be resume able and multiple download ??
kv
File download can be resumable/multidownloaded when your webserver allows files to be requested from arbitrary position. Eg., if it allows you to specify that a file download should start from 100th byte.
Philip
sorry but i little dumb on this. Very Happy
then how can if i make a user download a file from download.php
that download.php read file and give 100 byte every loop until a file finished download, can this way make it resume able and multidownload able ? or it need a setup from webserver or what ?
kv
If you have your own script to download file, you will not be able to provide resume and multidownload support for the downloads. If your webserver supports it and your file is directly under webserver doc root, user will be able to use these features.
Philip
oh.. i see, thanks..
so i need only to create a file to a user download,
and after a time i delete this file, right ? Smile

thanks
Related topics
[tutor] How to protect images without htaccess using PHP
Using PHP
Includ Images using PHP.
How to start using PHP? Help!
Creating a .txt file
Upload a preset file using PHP
Website Designing using PHP
how can i setup a page break for printer on html using php ?
Open, Write to and Close a txt file using php
Reading word documents using PHP?
I am trying to build a contact form using php and flash
Using php to change content of a .txt
Can I add tasks to Windows Scheduled Tasks - Using PHP?
Help displaying pdfs using PHP
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.