Enable zip file downloading from query results
Xiaopeng Xiong
xpxiong at PURDUE.EDU
Sun Oct 15 17:08:21 PDT 2006
This is great. Yes I think I will probably go this way you suggested. Thanks for the hints.
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.". But I was enable to double click the .zip file and activate the Winzip window, then get individual files out in this way.
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().
Thanks,
Xiaopeng
----- Original Message -----
From: Delfos, Jacob
To: MAPSERVER-USERS at LISTS.UMN.EDU
Sent: Sunday, October 15, 2006 7:37 PM
Subject: Re: [UMN_MAPSERVER-USERS] Enable zip file downloading from query results
Hi Xiaopeng,
I think for a single file, you can do:
<a href="zipfile.php?filename=[filename]">download zipped file</a>
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:
url="<a href=zipfile.php?filename='";
and then for each record, do:
url+="[filename],";
then at the end of the template:
url+="'>download all</a>";
document.write(url);
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.
regards,
Jacob
----------------------------------------------------------------------------
From: Xiaopeng Xiong [mailto:xpxiong at purdue.edu]
Sent: 16 October 2006 06:26
To: Delfos, Jacob; MAPSERVER-USERS at LISTS.UMN.EDU
Subject: Re: [UMN_MAPSERVER-USERS] Enable zip file downloading from query results
Thanks for the help. It works on the server side.
But there are still another part of the problem. When the query result is returned to the
query template, how to access the "FileLink" attribute of each record? And how to
send these FileLinks to server side PHP file?
Thanks,
Xiaopeng
----- Original Message -----
From: Delfos, Jacob
To: Xiaopeng Xiong ; MAPSERVER-USERS at LISTS.UMN.EDU
Sent: Thursday, October 12, 2006 11:29 PM
Subject: RE: [UMN_MAPSERVER-USERS] Enable zip file downloading from query results
Hi Xiaopeng,
There is a file from "Catalist Creative" on their website, which does that:
http://www.catalistcreative.com/tools/zipfile.php.txt
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:
Before the lines that say "Header ("Content ........", put another line that says:
Header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
regards,
Jacob
------------------------------------------------------------------------
From: UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU] On Behalf Of Xiaopeng Xiong
Sent: 13 October 2006 09:19
To: MAPSERVER-USERS at LISTS.UMN.EDU
Subject: [UMN_MAPSERVER-USERS] Enable zip file downloading from query results
Hello List,
I am very new to this field. I apologize if this question is not related but I do appreciate any suggestions.
I have one index that can be queried using mapserver. The query results are like follows:
Record | UL_X | FileLink
1 456000 http://myweb.com/photo/15.tif
2 460000 http://myweb.com/photo/38.tif
3 464000 http://myweb.com/photo/41.tif
Now what I want to realize is to provide an additional "Download_All" button in the query result page.
Then when the user clicks the "Download_All" button, all the files in "FileLink" will be compressed online
into one (e.g., .zip) file and downloaded.
How can this be realized? I'll apprecate any help or some reference to read.
Thank you.
Best,
Xiaopeng
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20061015/aca7d79e/attachment.htm>
More information about the MapServer-users
mailing list