LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices



Reply
 
Search this Thread
Old 05-18-2004, 12:27 PM   #1
devinWhalen
Member
 
Registered: Apr 2003
Location: Toronto, Canada
Distribution: Red Hat, openBSD,Mandrake,freeBSD,SunOS
Posts: 168

Rep: Reputation: 30
mod_perl and sending files to the client


Hey,

I am trying to send a file to the user so they can download it. I have it working but I want to make it conform to mod_perl but I don't know how to convert what I have to be more mod_perl like.

Basically this is what I send to the client. There is more above this but I don't need help on that.
Code:
# Three lines I want to change:
$r->print("Content-Type: application/vnd.ms-excel\n");
$r->print("Content-Transfer-Encoding: binary\n");
$r->print("Content-Disposition: attachment; filename=\"$fileName\"\n\n");


#creating the excel file
createExcelFile(\$result,\@titles,\$path,\$header);

#opening the file
my $XLS = Symbol::gensym();
open $XLS, "$path" or die "Can't open $path: $!\n";
binmode( $XLS );
#sending the file to the client
$r->send_fd($XLS);
  close($XLS);
The part I want to change but can't seem to find any good info on is the sending of the Content-Diposition. This is what I have so far:
Code:
$r->content_type("application/vnd.ms-excel");
$r->content_encoding("binary");
Any help would be appreciated. Also, am I sending the file correctly? It works but are there better ways?

Later
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Lynx browser, alternate mail client for sending comments to website authors SharpyWarpy Linux - Software 2 08-04-2005 11:21 AM
Sending message from server to client paulwong Linux - Networking 6 07-22-2005 10:55 AM
sending Objects from Server to Client djgerbavore Programming 0 10-04-2004 01:09 PM
gaim sending files moger Slackware 2 07-03-2004 01:44 PM
sending files over my network sandy_obrien Linux - Networking 6 05-02-2004 03:49 PM


All times are GMT -5. The time now is 11:57 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration