You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by cn...@nycap.rr.com on 2004/12/03 19:10:20 UTC

[users@httpd] Help, please, configuring httpd to allow downloads

I've got a blind spot on this feature and I don't seem to be able to figure out what I'm doing wrong.  I've read the FAQ and searched the archives without finding anything that seemed to directly address my issue.  I could really use a Cookbook here.  Please help.

I'm using httpd 1.3.29 and suExec and I want to have a button on a web page that allows a user to download a specific file (one that's application dependent, known by the CGI, not one that the user specifies).  I thought that the way to do this was to have a CGI that emitted:

   Content-type: application/octet-stream

followed by the bytes from the file and to run that CGI from something like:

    function download() {
      open('dl.cgi', 'Arg 2', '');
    }

in the Javascript for a button like:

    <input value='DL' type='button' onClick='download()'>

I thought this would prompt my browser to open a File Save dialog and let me pick a location for the bytes.  But that doesn't work.

So I tried:

    function download() {
      open('thefile.tgz', 'Arg 2', '');
    }

and made sure .tgz was in mime.types as application/octet-stream.  But that didn't work either.  I get an internal server error and error_log says that there was a premature end of script.

Can someone point me to a working example or give me a 100-words-or-less tutorial?  Thanks!

                           Chris


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Help, please, configuring httpd to allow downloads

Posted by Sean T Allen <se...@usaherbals.com>.
cnelson@nycap.rr.com wrote:

>
>So I tried:
>
>    function download() {
>      open('thefile.tgz', 'Arg 2', '');
>    }
>
>and made sure .tgz was in mime.types as application/octet-stream.  But that didn't work either.  I get an internal server error and error_log says that there was a premature end of script
>  
>

well when this 'didnt work'? what exactly didnt work... how far did it 
get? nothing served?
if you are just doing thefile.tgz then there isnt a script involved so 
that error wouldnt actually be
coming from that...

so what happened when you tried to get thefile.tgz and can you access it 
directly from the browser?


Re: [users@httpd] Help, please, configuring httpd to allow downloads

Posted by Ralf Glauberman <rg...@michaeli-gymnasium.de>.
does your cgi-skript work as it should? what happens, if you request the 
file directly, not by javascript?

----- Original Message ----- 
From: <cn...@nycap.rr.com>
To: <us...@httpd.apache.org>
Sent: Friday, December 03, 2004 7:10 PM
Subject: [users@httpd] Help, please, configuring httpd to allow downloads


> I've got a blind spot on this feature and I don't seem to be able to 
> figure out what I'm doing wrong.  I've read the FAQ and searched the 
> archives without finding anything that seemed to directly address my 
> issue.  I could really use a Cookbook here.  Please help.
>
> I'm using httpd 1.3.29 and suExec and I want to have a button on a web 
> page that allows a user to download a specific file (one that's 
> application dependent, known by the CGI, not one that the user specifies). 
> I thought that the way to do this was to have a CGI that emitted:
>
>   Content-type: application/octet-stream
>
> followed by the bytes from the file and to run that CGI from something 
> like:
>
>    function download() {
>      open('dl.cgi', 'Arg 2', '');
>    }
>
> in the Javascript for a button like:
>
>    <input value='DL' type='button' onClick='download()'>
>
> I thought this would prompt my browser to open a File Save dialog and let 
> me pick a location for the bytes.  But that doesn't work.
>
> So I tried:
>
>    function download() {
>      open('thefile.tgz', 'Arg 2', '');
>    }
>
> and made sure .tgz was in mime.types as application/octet-stream.  But 
> that didn't work either.  I get an internal server error and error_log 
> says that there was a premature end of script.
>
> Can someone point me to a working example or give me a 100-words-or-less 
> tutorial?  Thanks!
>
>                           Chris
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org