[Zope] auto download link

Small Business Services toolkit at magma.ca
Fri Feb 13 07:26:56 EST 2004


We keep a list of dtml documents in a folder called 'Attachments' which we
allow users to download by clicking on a link in a web page.  Here is the
code we use:

    <dtml-if "attachments">
      <dtml-in "attachments.keys()" sort>
        <a class="stdlink" href="Attachments/<dtml-var
sequence-item>"><dtml-var "attachments[_['sequence-item']]"></a><br>
      <dtml-else>
        none<br>
      </dtml-in>
    <dtml-else>
      none<br>
    </dtml-if>


Note:  'attachments' in our case is a list variable containing the ids of
the downloadable files.


HTH

Jonathan

----- Original Message -----
From: "Jerry" <lists411 at myd1.com>
To: "Zope" <zope at zope.org>
Sent: February 12, 2004 7:04 PM
Subject: [Zope] auto download link


> Hi Zopeople,
>
> I have some python files that I want users to be able to download.  I
> would like them to be able to click on the anchor and start
> downloading.  I must be missing something fundamental in Zope or HTML.
> I cannot figure out how to *download* the file instead of display it.
>
> I have tried creating a File object and DTML Document, tried changing
> the Content Type to application/msdownload (and about 20 other types).
> I have used DocFinder and tried all kind of method names (looking for
> the inverse of 'document_src').
>
> Is there a way to force the download action instead of rendering?
>
> --
> Jerry      (Mailed safely with The Bat! 2.02.3 CE)
> ___________________________
> Nobody can be un-cheered with a balloon.
>
>
> _______________________________________________
> Zope maillist  -  Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )




More information about the Zope mailing list