Category: php

.

Uzipping Files on Your Web Server

If you are using a free hosting account with godaddy.com and many of the other Free hosts out there, you may have found that they don't offer you a lot of features. One feature that I could not find on Godaddy.com free hosting accounts was a utility that would unzip my files after I uploaded them to my server. I had a dating site software that I was trying to install after I uploaded the zip files to my hosting server.

Thus, I wrote a PHP script to unzip my software. This is a quick and dirty hack, does not require a lot of knowledge of how zipfiles work, and the truth is the first example here really has less to do with how to use the php programming language and more to do with how to send system commands to the underlying Linux system using a php script.

Godaddy.com MAY have added a zipping feature since I wrote this tutorial. Even is so, this information is still useful for any hosting account that may lack a zip file feature. Oftentimes, I have a domain that is for testing purposes, so it really makes financial sense to take advantage of the free hosting accounts that Godaddy.com includes with each domain purchase.

Unzipping Files On Linux

My first example is on a Linux//Unix system running an apache server.

Unzipping files on a Linux system is easy. Linux comes with several zipping and unzipping programs that you can call up with the standard input(keyboard).

<?php system('unzip myZipFile.zip'); ?>

Viola!!! Its that simple. Nothing to it. If your zip File is not corrupted it will deflate with no problems - printing to screen a list of the files that were extracted

The "system()" command is just a way to send commands out to the server's operating system. You can actually use "system()" to run just about any program that can be found on the underlying operating system that is hosting your account if your account has the proper permissions.

Unzipping Files On Windows

Windows does not come with a similar unzip program.

So, we will do a little phping to accomplish this task

<?php $zip = new ZipArchive; if ($zip->open('test.zip') === TRUE) { $zip->extractTo('destination/directory/'); $zip->close(); echo 'ok'; } else { echo 'failed'; } ?>

I found the above example in the php manual. I did not see how I could possibly improve on the example, so I left it as is. I do, however, make every attempt to give credit to the correct authors when ever possible. I could have added a lot of fluff and loops to the code but that would only make the script more complicated than necessary. D.Shaun Morgan

Author: D.Shaun Morgan

passing data from one form to another form php Passing data from one form to another form To pass php data from a form and then catch that data into another form one way to accomplish this task is to intermi

Storing image locations mysql Storing Image Url Location in Mysql Database Storing images in the Mysql Database using php can be done by encoding the whole image with a function called base64enco

how to use dreamweaver Dreamweaver - WISIWIG Dreamweaver is a tool that arguably could be called the industry standard for web design . Dreamweaver, is an Adobe product that originally b

Filezilla Filezilla Ftp Client, FTP SERVER vs Wsftp By: D.Shaun Morgan While I was writing this article, about halfway through, I realized that it would be unfair to tell my readers about

notepad plus Notepad++ Download Notepad Plus Plus Notepad plus plus is an open source, free text editor. It is

.

Sign Up For
MrArrowhead.com

 

Leave a Comment

how-to-unzip-files-on-your-free-hosting-account

Name:      | Email:      | Website:

Comment:


captcha

Enter The Above Security Code: