Hi to all,
I'm new to G2 programming and I have a problem. I've searched on this site and on google but couldn't find an answer.
What I'm trying to do is to write a simple module that will check whether an album has an accompanying zip file in the album folder (zip filename = Albumname + ".zip") and if doesn't create the zip file. Then click a button and the zip file will be downloaded. Most of it I have already done by reading the doc here and looking at other models. However, I'm stuck with the downloading part. I have looked at the "DownloadItem.inc" file and the zipcart module and have either re-done or simply copied & pasted the necessary code parts. My problem is that the HTTP header for the "content-type" will not change from "plain/html" to "application/zip" and thus the browser will not interpret the stream as a binary file it's supposed to download. I have tried both the delegate and the redirect method but didn't succeed. I'd post my code here but I've simply copied the "sendFile()" method from DownloadItem class and I'm sure my problem starts before that.
Is there anyone who understands my problem and can help me?
Thanks in advance!
Posts: 16504
Why reinvent the wheel?
http://codex.gallery2.org/Gallery2:Modules:zipcart
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here
Posts: 13
Good question but I think zipcart is a little bit too complicated and I'd like to have per-Album zip download and not per "cart".
I'd appreciate any help!
Posts: 4342
You should post your code as an attachment; you can't expect other people to recreate precisely what you've done from your brief description, and tiny differences can make all the difference.
Posts: 13
Ok I've attached all my source files (and had to rename them to *.txt but of course they are *.inc on my computer) and hope someone can locate my problem. As I previously said much of my code was copied&pasted so don't be surprised if you recognise it
Thx for your help!
Posts: 4342
Probably easiest just to zip the entire module folder and post that...
Posts: 13
Here you go...
Posts: 13
Can anyone help me with this problem?
Posts: 13
I have found the solution for this problem: 2 newlines at the end will prevent phpVm->header() from working!
more here: http://gallery.menalto.com/node/87004