473,714 Members | 2,580 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Zip some folders and send by email

Using the standard php functions found on most web servers - how do i
zip selected folders and have the zip file emailed to myself .

Not as a cron job or anything automated - it will be a option i will add
in the control panel .
Jul 6 '06 #1
12 1748
Krustov wrote:
Using the standard php functions found on most web servers - how do i
zip selected folders and have the zip file emailed to myself .

Not as a cron job or anything automated - it will be a option i will add
in the control panel .
IMHO its a lot easier to do from the shell than in PHP. Write a shell script
and call it from PHP.

Something like:

#!/bin/bash

RECIP="$1"
if [ -z "$RECIP" ]; then
echo usage sendzip re*******@test. com file1 file2 file3 ....
fi

zip data.{$$}.zip $@
mail -a data{$$}.zip -s "Here are you warez" $RECIP <<<EOH

Here is the files you asked for.
EOH
C.

Jul 6 '06 #2
<comp.lang.ph p>
<Colin McKinnon>
<Thu, 06 Jul 2006 19:31:05 GMT>
<Zx************ ****@newsfe6-gui.ntli.net>
Using the standard php functions found on most web servers - how do i
zip selected folders and have the zip file emailed to myself .

Not as a cron job or anything automated - it will be a option i will add
in the control panel .

IMHO its a lot easier to do from the shell than in PHP. Write a shell script
and call it from PHP.
Haw pal - the only shells i know aboot is the wans fae the tally van .
--
Encrypted email address
www.emailuser.co.uk/?name=KRUSTOV
Jul 6 '06 #3

Krustov wrote:
Using the standard php functions found on most web servers - how do i
zip selected folders and have the zip file emailed to myself .

Not as a cron job or anything automated - it will be a option i will add
in the control panel .
Try this class I wrote some time ago:

http://www.conradish.net/bobo/show_s...ame=flyzip.php

It uses the zlib functions to compress the data. If the function aren't
there, then it just package the files.

Jul 6 '06 #4
<comp.lang.ph p>
<Chung Leong>
<6 Jul 2006 14:00:18 -0700>
<11************ *********@p79g2 000cwp.googlegr oups.com>
Try this class I wrote some time ago:

http://www.conradish.net/bobo/show_s...ame=flyzip.php

It uses the zlib functions to compress the data. If the function aren't
there, then it just package the files.
Thanks for that , Although i dont understand most of it or what each
part does at this stage .

Will get back to you on that one after i do the usual google search on
the subject and learn some basics .
--
Encrypted email address
www.emailuser.co.uk/?name=KRUSTOV
Jul 6 '06 #5
In article <11************ *********@p79g2 000cwp.googlegr oups.com>,
ch***********@h otmail.com says...
>
Krustov wrote:
Using the standard php functions found on most web servers - how do i
zip selected folders and have the zip file emailed to myself .

Not as a cron job or anything automated - it will be a option i will add
in the control panel .

Try this class I wrote some time ago:

http://www.conradish.net/bobo/show_s...ame=flyzip.php

It uses the zlib functions to compress the data. If the function aren't
there, then it just package the files.

Please forgive a silly question but can you tell me why you made it a
"class" rather than a simple set of functions?

nark
Jul 7 '06 #6
nark wrote:
In article <11************ *********@p79g2 000cwp.googlegr oups.com>,
ch***********@h otmail.com says...

Krustov wrote:
Using the standard php functions found on most web servers - how do i
zip selected folders and have the zip file emailed to myself .
>
Not as a cron job or anything automated - it will be a option i will add
in the control panel .
Try this class I wrote some time ago:

http://www.conradish.net/bobo/show_s...ame=flyzip.php

It uses the zlib functions to compress the data. If the function aren't
there, then it just package the files.

Please forgive a silly question but can you tell me why you made it a
"class" rather than a simple set of functions?

nark
No reason really. The code actually started out as a just a set of
functions. I wrapped it in a class when I used it as an example for an
article in php|architect. You know how people tend to think anything
dress up as a "component" is more sophisticated.

Jul 7 '06 #7
nark <na****@home.ho me.comwrote:
>
ch***********@ hotmail.com says...
>>
Krustov wrote:
Using the standard php functions found on most web servers - how do i
zip selected folders and have the zip file emailed to myself .

Not as a cron job or anything automated - it will be a option i will add
in the control panel .

Try this class I wrote some time ago:

http://www.conradish.net/bobo/show_s...ame=flyzip.php

It uses the zlib functions to compress the data. If the function aren't
there, then it just package the files.

Please forgive a silly question but can you tell me why you made it a
"class" rather than a simple set of functions?
It's fascinating that you would ask this question, and I suspect a PHP
newsgroup is the only one in which the value of encapsulation would be
questioned.

By defining a class, he is adding only one new name to the namespace,
instead of a whole set of names that might conflict with functions I
already have. In addition, it allows him to hide whatever state he might
need in the class object, instead of again polluting the namespace with
globals.

I know the PHP philosophy is to plop 100 functions into the global
namespace where one class name would do, but I suspect PHP programs would
be easier to read and maintain if the library were reorganized as classes
instead.
--
- Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Jul 8 '06 #8
Tim Roberts wrote:
It's fascinating that you would ask this question, and I suspect a PHP
newsgroup is the only one in which the value of encapsulation would be
questioned.

By defining a class, he is adding only one new name to the namespace,
instead of a whole set of names that might conflict with functions I
already have. In addition, it allows him to hide whatever state he might
need in the class object, instead of again polluting the namespace with
globals.
In economics there's an idea called "moral hazard," whereby a solution
to a social problem makes it worse because by moderating the negative
consequence it encourages the behaviors that causes the problem in the
first place. I have program in many languages and the only occasions
when I run into name collisions are in languages that have namespace,
notably C#.
I know the PHP philosophy is to plop 100 functions into the global
namespace where one class name would do, but I suspect PHP programs would
be easier to read and maintain if the library were reorganized as classes
instead.
Will that improve the productivity of a programmer, that's bottom line.
The answer is likely to be no. The cost of living with the potential of
name collision is low and incidental whereas the cost of reduced
visibility is high and is afflicted continually.

Jul 9 '06 #9
In article <ca************ *************** *****@4ax.com>, ti**@probo.com
says...
nark <na****@home.ho me.comwrote:
Please forgive a silly question but can you tell me why you made it a
"class" rather than a simple set of functions?

It's fascinating that you would ask this question, and I suspect a PHP
newsgroup is the only one in which the value of encapsulation would be
questioned.

By defining a class, he is adding only one new name to the namespace,
instead of a whole set of names that might conflict with functions I
already have. In addition, it allows him to hide whatever state he might
need in the class object, instead of again polluting the namespace with
globals.

I know the PHP philosophy is to plop 100 functions into the global
namespace where one class name would do, but I suspect PHP programs would
be easier to read and maintain if the library were reorganized as classes
instead.
--
- Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Totally the reverse.

By wrapping it in a class he has made the code unnecessarily complex
and obtuse to read making understanding of the function difficult
and the code therefore harder to read and maintain.

The use of classes for small amounts of code such as used by PHP
programmers writing what are not much more than a simple series of
scripts is plain stupid and says more about the ego of the programmer
than anything else.

Anything that actually requires classes should bedone in a real reliable
language not a buggy script language like PHP.

Jul 9 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
6100
by: Karuppasamy | last post by:
Hi I want to populate all the files and folders of System in a Treeview control like Windows Explorer. I try this using File System Objects. But sometimes I am getting an error like 'Access Denied". Why am I getting an error like this? How to populate the TreeView with Folders and files of the System?
3
2358
by: musicloverlch | last post by:
Can MS Access be used to create folders on a drive? I need to create about 700 folders. Thanks, Laura
1
1306
by: Nut Cracker | last post by:
Hello, If anyone can point me to a good ASP based Control Panel for IIS5, I would be much obliged. I hacked together an ASP site for file uploads and sharing. Its very simple, and basically shows the user the files that exist in one folder. I want to expand this functionallity so that they can create/delete subfolders and files under thier root folder on the webserver. And perhaps eventually allow the users to create subfolders and...
5
2686
by: George | last post by:
VB.net 2003 standard, XP windows home edition. Installed first application OK today. When I removed the application via Control Panel, there were no problems and the app folders were deleted. But when I installed the app from a CD-ROM (Release folder is in D:), when I remove the app in Control Panel these problems occur: Control Panel does not delete the application folders. When I try to delete them I get message "Cannot delete file:...
3
1615
by: jerryyang_la1 | last post by:
I'm looking for a script / scripts that will allow me to control files that users can download. I would like to create 'General Folder' that any registered user can download from and private folders that only the specified registered user can download from. This needs to be simple to manage and simple to download from. Any Ideas ?
7
2011
by: jonathandrott | last post by:
sorry newbie question probably. i'm trying to open an specific folder. open each file with in the folder individually and process each one. all the processing code has been written. i'm looking for sample code to open the folder and start grabbing files. thanks.
1
2121
by: =?Utf-8?B?UmFjaW5yaG9uZGE=?= | last post by:
I had a hard drive failure and had to re-load Microsoft Office XP. When I first loaded, I had no data files so I imported my pst files from my old hard drive and now I have double of everything and it's very confusing. It appears that I have one set of imported folders that were created in the folders initially created when I reloaded Office XP and now most of my old data is in these folders as well. I did a test send email to myself...
3
3371
by: neopersia | last post by:
hello I'm designing a newsletter for my site and I gonna send my newsletters using mail() function. I want each user that receives newsletter be able to see just his email address in "TO" field and I wanna hide the other users. I know that it's not a correct way to repeat mail() function for each single newsletter user but when I use BCC header my emails will go to SPAM folders! Please guide me how to use headers to send my newsletter out...
1
1139
by: alqui | last post by:
Hi, I'm actually trying to resolve a simple problem. I'm trying to build my Web site. The structure of the Web site looks like that : /Element /Element/App_Code /Element/Admin /Element/Modules /UserControls There are aspx pages in every folders except /UserControls where all my ascx
0
8797
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9309
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9071
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9010
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7946
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5945
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4462
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4717
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2514
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.