News Feed
Jobs Feed
Sections




News Archive
feed this:

Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Rob Allen:
Creating a zip file with PHP's ZipArchive
January 15, 2014 @ 15:40:59

Rob Allen has a new post to his site today showing you how to create a ZIP file with the help of PHP's ZipArchive functionality. The latest versions would need to be installed as an extension (PECL) if they're not already there, but it makes creating the archives a lot simpler.

I recently had a requirement to create a zip file from a number of files created within my application. As it has been years since I last had this problem, I had a look around and discovered that PHP 5.2 has the ZipArchive class that makes this easy. ZipArchive is fully featured, but as I just wanted to create a simple zip file.

All it requires is a few short lines of code - one to open the archive itself, some to add in the files to compress down and another to close and create the file. It's a pretty simple process using this handy extension. Rob also included a bit of sample code showing how to send it out for download with the correct headers.

0 comments voice your opinion now!
zip file archive create tutorial ziparchive

Link: http://akrabat.com/php/creating-a-zip-file-with-phps-ziparchive

WebSpeaks.in:
Extract the Content of Zip file Using PHP
June 13, 2012 @ 10:44:44

On the WebSpeaks.in site, there's a recent tutorial posted showing how you can extract the contents of a zip file from inside a PHP application.

Sometimes you may want the users on your site to upload the zip file and then check what are the contents of that zip file. In this article I will tell you how to extract the contents of the zip file. I temporarily extract the zip files to a directory and then delete it afterwards. You can chose to keep the extracted content if you want.

The tutorial walks you through the code, showing you how to use their "ZipArchive" class to grab the file, extract the contents and display a list of the "child files" inside it. You can see a live demo of it in action or just download the source and dive right in.

0 comments voice your opinion now!
extract content zip archive list tutorial demo


PHPMaster.com:
Sending Emails with PHP
October 24, 2011 @ 20:08:52

In a new tutorial from PHPMaster.com Jason Pasnikowski takes a look at sending emails with PHP - an introduction to what the language offers and how it can be used to send an HTML version.

In most cases your installation of PHP will be capable of sending emails. If you are using a shared host, or if you installed PHP using a package management system like apt-get, more than likely you're all set. You'll really only need to worry about extra configuration if you're compiling PHP from source or if you're running it on Windows. In either case, there are plenty of resources available online to help you out. Because that's all beyond the scope of this article, I'll assume you're set. If not, Google will be your friend.

He starts with a simple example using the mail function but quickly moves on to sending a multi-part email with an attached zip file and HTML content. He includes the all code you'll need and explains each part in detail so you'll know exactly what's going on.

0 comments voice your opinion now!
send email tutorial html multipart zip file


PHPBuilder.com:
Working with Zip Archives in PHP
April 07, 2010 @ 08:44:54

On PHPBuilder.com today Octavia Anghel has written up a tutorial about working with zip archive files directly from PHP. The key is the Zip Archive extension that you can get from the PECL repository if you have a version older than PHP 5.2. Those on PHP 5.2 or higher already have it bundled in.

I explain how to manage Zip archive files in PHP using a number of demo PHP applications. You'll learn how to create Zip archives, add files and folders inside the archive from a string and from a given path, delete and rename files using their indexes and names and list the ZipArchive object details (number of files, filenames, comments, statusSys, etc.).

Complete code for the examples (along with a few screenshots) are included in the tutorial as well as a link to download the source to get you started even faster.

0 comments voice your opinion now!
archive zip tutorial pecl extension


NETTUTS.com:
How to Open Zip Files with PHP
December 31, 2008 @ 12:04:06

The NETTUTS.com site has a new tutorial/screencast posted looking at their method for opening up uploaded zip files with PHP:

ThemeForest has a nice feature; It allows the authors to upload zip files containing screenshots of their themes. A script then extracts these files and displays the images accordingly. Though I doubt that the developers used PHP to accomplish this task...that's what we're going to use!

They create a simple form with one field - a file input - and write some basic PHP around it. The script ensures that it was a zip file that was uploaded (based on the mime type) and passes it through a ZipArchive class to do the hard work. This class and the rest of the source can be downloaded from the site.

0 comments voice your opinion now!
open zip file tutorial upload mime type download source


Jani Hartikainen's Blog:
Zend Framework components as separate zips from the main distro? Sure!
October 07, 2008 @ 09:39:44

Jani Hartikainen has put together a handy script for those out there that like what the Zend Framework is all about but don't really need the whole thing to get the job done. If that's you, this script might be just what you need.

Did you ever want to use just a single component from Zend Framework, but couldn't figure out which files you needed? Well, here's a solution: Zend Framework packageizer script! Just pick the class you want, and you'll get it and all its dependencies in a nice zip file for you to consume.

The packager uses the tokenizer functionality PHP offers natively to look through the files for the package you're after and finds all of the files that might need to be included and pulls them right along into the zip file.

0 comments voice your opinion now!
zendframework tokenizer include dependencies package zip


Joey's Blog:
8 Practical PHP Regular Expressions
October 17, 2007 @ 10:27:00

On his web development blog, Joey has posted a new list of eight handy regular expressions you can use in your code for common validations.

Here are eight examples of practical PHP regular expressions and techniques that I've used over the past few years using Perl Compatible Regular Expressions. This guide goes over the eight different validation techniques and describes briefly how they work. Usernames, telephone numbers, email addresses, and more.

Each of the regular expressions comes complete with an explanation of what it is and the kinds of strings it's looking for. Comments on the post have helped even more, finding places where they might break or not catch all possibilities.

1 comment voice your opinion now!
regular expression list practical username phone email zip ipaddress date regular expression list practical username phone email zip ipaddress date


Web Development Blog:
Tutorial Create a zip file from folders on the fly
September 28, 2007 @ 10:24:00

On the Web Development Blog, there's a quick tutorial on creating dynamic zip files via a helpful little class:

For a future project I needed these days some easy to use zip or gzip class to create a zip file from files / folders inside a specified directory. [...] I tested two [other] scripts before and must say that this script works great for single files if you add them manually. To compress a whole directory with an unknown number of files into one zip file I created some class extension to get this job done.

In his class, the get_file_from_folder method is called with the directory and the file to load them into. This loops through the files, pulling them all (directories and all) into the new zip file. An example of the class' use is also included.

0 comments voice your opinion now!
zip file folder directory automatic class example zip file folder directory automatic class example


Rob Allen's Blog:
Zend Framework Tutorial Zip File Updated
August 13, 2007 @ 08:46:00

Rob Allen has posted about more updates that have been made to his Zend Framework tutorial zip file - one now contains a copy of the framework, the other doesn't.

This time, I've created two files: one with the Zend Framework (1.0.1) included and one without. The one without is much smaller at only 9KB, where as with the Framework, the zip is 2.2MB.

You can download the version with just the tutorial or with the combination directly from his websites. The tutorial has also been bumped up a version (to 1.4.4) with a few updates.

0 comments voice your opinion now!
zendframework tutorial zip file update include bundle zendframework tutorial zip file update include bundle


JBLabs Blog:
How to create a zip archive using PHP
July 03, 2007 @ 11:08:00

On the JSLabs blog today, there's a (short) new tutorial showing an alternate method to creating a Zip archive in PHP (rather than with the zip extension).

He illustrates the creation of simple archive that pulls in a test file from a given path. This is then pushed into the zip archive and packed down and exported. He also notes the different compression levels that it can be created with - no compression, bzipped and gzipped.

You can download the library here.

0 comments voice your opinion now!
zip compress archive library bzip gzip zip compress archive library bzip gzip



Community Events











Don't see your event here?
Let us know!


example overview security language hack unittest facebook hhvm application install introduction composer podcast opinion symfony2 framework component release code package

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework