implementing download using a url call
rosuav at gmail.com
Fri Mar 28 03:26:51 CET 2014
On Fri, Mar 28, 2014 at 12:34 PM, <tanmay.kansara at gmail.com> wrote:
> Hey Guys,
> here is what I am trying to solve.
> I have a URL - somesite.com/server/pattern.x?some_more_stuff
> This URl is out there as an href tag on users website. Is there a way in which I can serve a file(not from my server) while ensuring that the users remain on the third party website. I am currently using this :
> myfile = "http://download.someothersite.com/somefile.exe"
> meta_tag = "<html><head><meta http-equiv='Refresh' Content='1;URL=%s'></head></html>" % myfile
> return HttpResponse(meta_tag, content_type='force-download')
> The above works, however the user gets redirected to a blank page. Would downloading and serving the file from my server be a better option? If so, some pointers please.
So what you want is for the user to go to a page which both downloads
a file *and* displays content, is that it?
This is fairly common on the web today; have a look at how places like
Sourceforge do it.
More information about the Python-list