Re: Apache::File and setting filename
[prev]
[thread]
[next]
[Date index for 2005/05/17]
Scott Alexander wrote:
> Hi,
>
> Is it possible with Apache::File to set the name of the filename?
> (Apache/1.3.31 (Unix) mod_perl/1.29 configured)
For the record:
$fh = Apache::File->new($file) or warn "Can't open $file $!";
$r->content_type('application/octet-stream');
$r->headers_out->set('Content-Disposition' => "attachment;
filename=$file");
$r->send_http_header ;
$r->send_fd($fh) ;
works fine.
Scott
>
> I have
>
> print "Content-type: application/octet-stream\n\n" ;
> $file = "myfile_to_send.doc" ;
> $fh = Apache::File->new($file) or warn "Can't open $file $!";
>
> $r->headers_out->set("Content-Disposition" => "inline;
> filename=$file") ; $r->send_http_header ;
> $r->send_fd($fh) ;
> It sends the file ok, the user is prompted to save the document as the
> same name of the action of my htm form.
>
> I want to have in the interface two links for opening a file: one to
> open and one to download
>
> Regards
> Scott
 |
 |
Re: Apache::File and setting filename
Scott Alexander 15:35 on 17 May 2005
|