473,386 Members | 1,706 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

PHP exec() and Zipping Upload file in Windows

I have the following code. What I need is to zip the file
(c:\web\upload\someFile) to d:\web\someFile.zip.

$cmd = 'c:\zip\zip.exe '. $movedFile. ' '. $finalFile;
exec( $cmd, $cmd_output );

File is being uploaded by the apache server, but it's not being zipped.
My guess "\", escaping, is causing problem in windows path. Do I also
have to escape the $movedFile content? Forexample $movedFile=
"c:\web\upload\someFile".

Dec 20 '06 #1
2 4088
I have the feeling that it's not because of the escape string.
If the string is already in a variable, PHP won't take account of the
escape sequence
(coz it's already escaped).
Anyway, PHP only escape strings that are surrounded by double quote (")
not single quote (')
Hendri

johnny wrote:
I have the following code. What I need is to zip the file
(c:\web\upload\someFile) to d:\web\someFile.zip.

$cmd = 'c:\zip\zip.exe '. $movedFile. ' '. $finalFile;
exec( $cmd, $cmd_output );

File is being uploaded by the apache server, but it's not being zipped.
My guess "\", escaping, is causing problem in windows path. Do I also
have to escape the $movedFile content? Forexample $movedFile=
"c:\web\upload\someFile".
Dec 20 '06 #2

johnny ha escrito:

$cmd = 'c:\zip\zip.exe '. $movedFile. ' '. $finalFile;
exec( $cmd, $cmd_output );
to manage and create zip files , use the zip extension available since
php 5.2.0 or via PECL (and pecl4win if you are using windows)

Dec 20 '06 #3

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

Similar topics

6
by: Hal Vaughan | last post by:
I have a script used to find and run Java on a Windows system.  It worked fine on original tests (on a Windows XP system).  It's now running on a Windows 2000 (sp3) system, and it won't work -- the...
1
by: Hal Vaughan | last post by:
I've been using Runtime.exec() like this: Runtime rt = Runtime.getRuntime(); try {Process p = rt.exec("MyCommand.bat");} catch (Exception e) {do stuff} When I start my Java classes, I start...
2
by: Arthur | last post by:
Does anyone know if the new Windows 2003 built-in .zip compressor/decompressor is available to scripting? If so, can you kindly point me in the right direction? I've searched and searched MSDN...
0
by: Benjamin Bittner | last post by:
hallo ng, first of all, for the zipping progress i use the ziplib from http://www.icsharpcode.net/OpenSource/SharpZipLib/Default.aspx now to my problem. im trying to build a little application...
17
by: comp.lang.tcl | last post by:
The TCL command I am using will do a command-line action on a PHP script: set cannotRunPHP I have to do it this way as both the TCL script and the PHP script run as CLI. However, "info.php"...
5
by: snicks | last post by:
I'm trying to exec a program external to my ASP.NET app using the following code. The external app is a VB.NET application. Dim sPPTOut As String sPPTOut = MDEPDirStr + sID + ".ppt" Dim p As...
6
by: reidarT | last post by:
I will develop a backup routine with local files (zipped) to an internet server via ftp. How do I zip files in Vb.net? reidarT
4
by: Tom | last post by:
I have a script which allows a user to upload a file. The script does some filename editing, mimetype checking, etc., and it's then supposed to send the file to a remote server, without any...
7
by: dragiton | last post by:
SA Upload SQL Database variable types (image upload and storage) I am having trouble with the SA Upload utility. The following code used to work correctly. However, I lost my database and had to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.