[Flask] Serving a file to downalod AND print message on screen

sidwoodstock . sidwoodstock at gmail.com
Tue Nov 21 12:35:49 EST 2017


Just some thoughts:

- Verify file is truly placed in /uploads/
- Verify your file server is exposing your uploads directory.
- You can move around the code in your template which shows flashed
messages, perhaps move it to a place which gets called when you want.

To truly help with the uploads / file not found issue, it'd be helpful to
know what other packages you're using.


Scott Woodstock



On Fri, Nov 17, 2017 at 9:00 AM, <flask-request at python.org> wrote:

> Send Flask mailing list submissions to
>         flask at python.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         https://mail.python.org/mailman/listinfo/flask
> or, via email, send a message with subject or body 'help' to
>         flask-request at python.org
>
> You can reach the person managing the list at
>         flask-owner at python.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Flask digest..."
>
>
> Today's Topics:
>
>    1. Re: Serving a file to downalod AND print message on screen
>       (Geert Stappers)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Thu, 16 Nov 2017 21:16:10 +0100
> From: Geert Stappers <stappers at stappers.nl>
> To: flask at python.org
> Subject: Re: [Flask] Serving a file to downalod AND print message on
>         screen
> Message-ID: <20171116201610.GX21385 at gpm.stappers.nl>
> Content-Type: text/plain; charset=us-ascii
>
> On Wed, Nov 15, 2017 at 05:47:19PM +0000, Kumar, Abhinav wrote:
> > Hi,
> >
> > After I process some data, I want to write log output to the screen and
> let user download the results as a zip file.
> >
> > I tried flash, but that does not print message until the app is executed
> next time.
> >
> > I can't possible use two return statements (one for send_file for
> download and other for rendering a template).
> >
> > I could use only template rendering and provide a link to download the
> results file in the template html file, but that link says 'file not
> found'...
> >
> > In my template file I have code like
> >     Please download the result  <a href=/upload/results.zip>here</a>
> > And I place the results.zip file in "upload" folder before calling
> render_template.
> >
> > But the app says "The requested URL was not found on the server"
> > The URL it points to is "http://akumar-linux2:5000/upload/results.zip"
> >
>
> FWIW   I read above _two_ problems:
>  * URL not found
>  * wanting to write to screen
>
>
> Advice: Start with fixing the "URL not found".
>
>
>
>
>
> Groeten
> Geert Stappers
> Seen both postings from original poster, replying on one.
> --
> Leven en laten leven
>
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> Flask mailing list
> Flask at python.org
> https://mail.python.org/mailman/listinfo/flask
>
>
> ------------------------------
>
> End of Flask Digest, Vol 29, Issue 3
> ************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/flask/attachments/20171121/54def9c8/attachment.html>


More information about the Flask mailing list