<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2963" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Thank Jacob, for your patient help.</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial size=2>I got the same results after apply the
realpath.</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial>I will still try to work it out. If it does not work, I
will probably let php call the gzip command to do the task, and
put the </FONT></DIV>
<DIV><FONT face=Arial>output file in a temp folder and remove afterwards. Let me
try ... See what will happen</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial>Best,</FONT></DIV>
<DIV><FONT face=Arial>Xiaopeng</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<BLOCKQUOTE dir=ltr
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=Jacob.Delfos@MAUNSELL.COM
href="mailto:Jacob.Delfos@MAUNSELL.COM">Delfos, Jacob</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A
title=MAPSERVER-USERS@LISTS.UMN.EDU
href="mailto:MAPSERVER-USERS@LISTS.UMN.EDU">MAPSERVER-USERS@LISTS.UMN.EDU</A>
</DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Sunday, October 15, 2006 10:47
PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [UMN_MAPSERVER-USERS] Enable
zip file downloading from query results</DIV>
<DIV><BR></DIV>
<DIV dir=ltr align=left><SPAN class=582044502-16102006><FONT face=Arial
color=#0000ff size=2>It is probably because of your add_dir. Try doing
this:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=582044502-16102006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=582044502-16102006><FONT face=Arial
color=#0000ff size=2>$zipdir = realpath(./yourfile.img);</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=582044502-16102006><FONT face=Arial
color=#0000ff size=2>add_dir($zipdir);</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=582044502-16102006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=582044502-16102006><FONT face=Arial
color=#0000ff size=2>basically, realpath turns a relative path into an
absolute path. This is the approach I have used to get the right path for this
script.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=582044502-16102006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=582044502-16102006><FONT face=Arial
color=#0000ff size=2>regards,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=582044502-16102006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=582044502-16102006><FONT face=Arial
color=#0000ff size=2>Jacob</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=582044502-16102006></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=582044502-16102006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=582044502-16102006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV><FONT face=Arial
color=#0000ff></FONT><BR>
<BLOCKQUOTE dir=ltr
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> UMN MapServer Users List
[mailto:MAPSERVER-USERS@LISTS.UMN.EDU] <B>On Behalf Of </B>Xiaopeng
Xiong<BR><B>Sent:</B> 16 October 2006 08:08<BR><B>To:</B>
MAPSERVER-USERS@LISTS.UMN.EDU<BR><B>Subject:</B> Re: [UMN_MAPSERVER-USERS]
Enable zip file downloading from query results<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV><FONT face=Arial size=2>This is great. </FONT><FONT face=Arial
size=2>Yes I think I will probably go this way you suggested. Thanks for the
hints.</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial>But I found a small problem when use the
zipfile.php. After I downloaded the zipped file to my windows
machine via the zipfile.php, I could not use "extract to here" or
"extract to folder XXX" of the Winzip functionality, it complains that
"start of central directory not found; Zip file corrupt. Possible cause:
file transfer error.". </FONT><FONT face=Arial>But I was enable to double
click the .zip file and activate the Winzip window, then get individual
files out in this way. </FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial>I am not sure whether I used the zipfile class right,
I passed "./" to add_dir() since the files to be zipped are in the same
directory as the .php file, and repeated passed a file name (e.g.,
test1.txt) to add_file().</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial>Thanks,</FONT></DIV>
<DIV><FONT face=Arial>Xiaopeng</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<BLOCKQUOTE dir=ltr
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=Jacob.Delfos@MAUNSELL.COM
href="mailto:Jacob.Delfos@MAUNSELL.COM">Delfos, Jacob</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A
title=MAPSERVER-USERS@LISTS.UMN.EDU
href="mailto:MAPSERVER-USERS@LISTS.UMN.EDU">MAPSERVER-USERS@LISTS.UMN.EDU</A>
</DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Sunday, October 15, 2006 7:37
PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [UMN_MAPSERVER-USERS]
Enable zip file downloading from query results</DIV>
<DIV><BR></DIV>
<DIV dir=ltr align=left><SPAN class=463022723-15102006><FONT face=Arial
color=#0000ff size=2>Hi Xiaopeng,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=463022723-15102006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=463022723-15102006><FONT face=Arial
color=#0000ff size=2>I think for a single file, you can
do:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=463022723-15102006><FONT face=Arial
color=#0000ff size=2><a
href="zipfile.php?filename=[filename]">download zipped
file</a></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=463022723-15102006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=463022723-15102006><FONT face=Arial
color=#0000ff size=2>For downloading all files, I don't think there is a
very straightforward way to do this, except by building up a URL on the
fly. Perhaps you could use javascript to add to the URL, for example at
the beginning of the template put:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=463022723-15102006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=463022723-15102006><FONT face=Arial
color=#0000ff size=2>url="<a
href=zipfile.php?filename='";</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=463022723-15102006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=463022723-15102006><FONT face=Arial
color=#0000ff size=2>and then for each record, do:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=463022723-15102006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=463022723-15102006><FONT face=Arial
color=#0000ff size=2>url+="[filename],";</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=463022723-15102006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=463022723-15102006>then at the end of the
template:</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=463022723-15102006></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=463022723-15102006>url+="'>download
all</a>";</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=463022723-15102006>document.write(url);</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=463022723-15102006></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=463022723-15102006>This is untested code, but I think that's how I
would go about it. You would have to change zipfile.php to read in url,
and use "explode" to get the file from the comma delimited
list.</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=463022723-15102006></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=463022723-15102006>regards,</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=463022723-15102006></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=463022723-15102006>Jacob</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=463022723-15102006></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV><BR></DIV>
<BLOCKQUOTE dir=ltr
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> Xiaopeng Xiong
[mailto:xpxiong@purdue.edu] <BR><B>Sent:</B> 16 October 2006
06:26<BR><B>To:</B> Delfos, Jacob;
MAPSERVER-USERS@LISTS.UMN.EDU<BR><B>Subject:</B> Re:
[UMN_MAPSERVER-USERS] Enable zip file downloading from query
results<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV><FONT face=Arial size=2>Thanks for the help. It works on the server
side.</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial>But there are still another part of the
problem. When the query result is returned to the </FONT></DIV>
<DIV><FONT face=Arial>query template, how to access the "FileLink"
attribute of each record? And how to </FONT></DIV>
<DIV><FONT face=Arial>send these FileLinks to server side PHP
file?</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial>Thanks,</FONT></DIV>
<DIV><FONT face=Arial>Xiaopeng</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<BLOCKQUOTE dir=ltr
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=Jacob.Delfos@maunsell.com
href="mailto:Jacob.Delfos@maunsell.com">Delfos, Jacob</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=xpxiong@PURDUE.EDU
href="mailto:xpxiong@PURDUE.EDU">Xiaopeng Xiong</A> ; <A
title=MAPSERVER-USERS@LISTS.UMN.EDU
href="mailto:MAPSERVER-USERS@LISTS.UMN.EDU">MAPSERVER-USERS@LISTS.UMN.EDU</A>
</DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Thursday, October 12, 2006
11:29 PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> RE:
[UMN_MAPSERVER-USERS] Enable zip file downloading from query
results</DIV>
<DIV><BR></DIV>
<DIV dir=ltr align=left><SPAN class=754312503-13102006><FONT
face=Arial color=#0000ff size=2>Hi Xiaopeng,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=754312503-13102006><FONT
face=Arial color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=754312503-13102006><FONT
face=Arial color=#0000ff size=2>There is a file from "Catalist
Creative" on their website, which does that:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=754312503-13102006><FONT
face=Arial color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=754312503-13102006><FONT
face=Arial color=#0000ff size=2><A
href="http://www.catalistcreative.com/tools/zipfile.php.txt">http://www.catalistcreative.com/tools/zipfile.php.txt</A></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=754312503-13102006><FONT
face=Arial color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=754312503-13102006><FONT
face=Arial color=#0000ff size=2>I have used it a fair bit for this
purpose. You basically have to modify it to point to the right files.
If you use it, please make the following change, otherwise you will
run into problems if you try to open the zip-file straight from
Internet Explorer:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=754312503-13102006><FONT
face=Arial color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=754312503-13102006><FONT
face=Arial color=#0000ff size=2>Before the lines that say "Header
("Content ........", put another line that says:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=754312503-13102006><FONT
face=Arial color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=754312503-13102006><FONT
face=Arial color=#0000ff size=2>Header("Cache-Control:
must-revalidate, post-check=0, pre-check=0");</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=754312503-13102006><FONT
face=Arial color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=754312503-13102006><FONT
face=Arial color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=754312503-13102006><FONT
face=Arial color=#0000ff size=2>regards,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=754312503-13102006><FONT
face=Arial color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=754312503-13102006><FONT
face=Arial color=#0000ff size=2>Jacob</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=754312503-13102006><FONT
face=Arial color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=754312503-13102006><FONT
face=Arial color=#0000ff size=2></FONT></SPAN> </DIV><FONT
face=Arial color=#0000ff></FONT><BR>
<BLOCKQUOTE dir=ltr
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> UMN MapServer Users List
[mailto:MAPSERVER-USERS@LISTS.UMN.EDU] <B>On Behalf Of </B>Xiaopeng
Xiong<BR><B>Sent:</B> 13 October 2006 09:19<BR><B>To:</B>
MAPSERVER-USERS@LISTS.UMN.EDU<BR><B>Subject:</B>
[UMN_MAPSERVER-USERS] Enable zip file downloading from query
results<BR></FONT><BR></DIV>
<DIV></DIV><FONT face=Arial size=2>
<DIV><FONT size=2>Hello List,</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>I am very new to this field. </FONT><FONT size=2>I
apologize if this question is not related but I do appreciate
any suggestions.</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>I have one index that can be queried using
mapserver. The query results are like follows:</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>Record |
UL_X |
FileLink</FONT></DIV>
<DIV>1
456000 <A
href="http://myweb.com/photo/15.tif">http://myweb.com/photo/15.tif</A></DIV>
<DIV>2
460000 <A
href="http://myweb.com/photo/38.tif">http://myweb.com/photo/38.tif</A></DIV>
<DIV>3
464000 <A
href="http://myweb.com/photo/41.tif">http://myweb.com/photo/41.tif</A></DIV></FONT>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial>Now what I want to realize is to provide an
additional "Download_All" button in the query result
page.</FONT></DIV>
<DIV><FONT face=Arial>Then when the user clicks
the "Download_All" button, all the files in
"FileLink" will be compressed online </FONT></DIV>
<DIV><FONT face=Arial>into one (e.g., .zip) file and
downloaded.</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial>How can this be realized? I'll apprecate any
help or some reference to read.</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial size=2>Thank you.</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial>Best,</FONT></DIV>
<DIV><FONT face=Arial
size=2>Xiaopeng</FONT></DIV></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>