Re: Downloading file AGAIN.

2001-10-15 Thread $Bill Luebkert

Morse, Richard E wrote:
 
 I'm not sure about it cutting off, but handling the naming issue of the download
 is something that I've dealt with before -- basically, most browsers are going
 to save the file by the name of the page they are getting it from.  The trick is
 to fool the browsers into believing that they are downloading something by the
 name of the file you want.  Happily, the HTTP specification includes the ability
 to pass extra path info.  It's been a while since I wrote the code to do this,
 so I don't remember all of it, but basically, you want something that you call
 like this:
 
 http://mysite.com/myscript.cgi/path/to/my/file?any=extra+cgi+params
  --^

When using PATH_INFO, you use / instead of ? to start the arg list:

http://mysite.com/myscript.cgi/relativepathtomy/script/any=extra+cgi+params

 Then myscript.cgi looks at an environment variable (whose exact name I can't
 remember off the top of my head, but is something like $ENV{'PATH_INFO'}) to
 determine which file to send back.

-- 
  ,-/-  __  _  _ $Bill Luebkert   ICQ=14439852
 (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED] 
  / ) /--  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



Re: Downloading file AGAIN.

2001-10-15 Thread Rodney Wines

  http://mysite.com/myscript.cgi/path/to/my/file?any=extra+cgi+params
   --^

 When using PATH_INFO, you use / instead of ? to start the arg list:

 http://mysite.com/myscript.cgi/relativepathtomy/script/any=extra+cgi+params

Definately yes and no ...

It's true that you use / to specify PATH_INFO, but you do not have to use
it instead of  ?.  You can use it in addition to as well.  In the example
above, I'm assuming that the CGI script is:

http://mysite.com/myscript.cgi

Then, /path/to/my/file shows up in $ENV{PATH_INFO}, and
any=extra+cgi+params shows up in $ENV{QUERY_STRING}.  In your example,
everything shows up in $ENV{PATH_INFO}, and there'd be an extra step to split
out the parameters.  Both methods work, however.

Rodney

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



Re: Downloading file AGAIN.

2001-10-15 Thread $Bill Luebkert

Rodney Wines wrote:
 
   http://mysite.com/myscript.cgi/path/to/my/file?any=extra+cgi+params
--^
 
  When using PATH_INFO, you use / instead of ? to start the arg list:
 
  http://mysite.com/myscript.cgi/relativepathtomy/script/any=extra+cgi+params
 
 Definately yes and no ...
 
 It's true that you use / to specify PATH_INFO, but you do not have to use
 it instead of  ?.  You can use it in addition to as well.  In the example
 above, I'm assuming that the CGI script is:
 
 http://mysite.com/myscript.cgi
 
 Then, /path/to/my/file shows up in $ENV{PATH_INFO}, and
 any=extra+cgi+params shows up in $ENV{QUERY_STRING}.  In your example,
 everything shows up in $ENV{PATH_INFO}, and there'd be an extra step to split
 out the parameters.  Both methods work, however.

My mistake - I misread the orig path.  Yes the orig path should set both 
PATH_INFO and QUERY_STRING the way it was written.  I'm not sure which 
one will be more acceptable to MSIE which is the guy that is usually so 
hard to get to set the download name properly.

-- 
  ,-/-  __  _  _ $Bill Luebkert   ICQ=14439852
 (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED] 
  / ) /--  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



RE: Downloading file.

2001-10-12 Thread Alexei Danchenkov

Hi, Krung,
Apparently you didn't sent the actual file, only the header. You need to
read it from the file handle and print it out to your output stream.
I assume this must be:
use constant BUFFERSIZE = 65536;
binmode $filehandle;
binmode OUTPUT; # This is your OUTPUT stream
while ( read ( $filehandle, $buffer, BUFFERSIZE ) ) {
  print OUTPUT, $buffer;
}
HTH, Alexei

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Krung
Saengpole
Sent: Friday, October 12, 2001 3:34 PM
To: [EMAIL PROTECTED]
Subject: Downloading file.


Hello all,

I have a problem about sending file to user. I made one zip file containing
one text file and send this file to user. User only receives the file but no
content in it. What's wrong I made to this script?

my script:

$file=test.zip;

print HeaderSent;
Content-Type: application/octet-stream; name=$file
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=$file
Expires=0

HeaderSent


TIA.

Krung
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



RE: Downloading file.

2001-10-12 Thread Krung Saengpole

My script works!!! but have to modify a little. Thank you very much.

Krung.
-- Original Message --
From: Alexei Danchenkov [EMAIL PROTECTED]
Date: Fri, 12 Oct 2001 15:54:51 +0400

Hi, Krung,
Apparently you didn't sent the actual file, only the header. You need to
read it from the file handle and print it out to your output stream.
I assume this must be:
use constant BUFFERSIZE = 65536;
binmode $filehandle;
binmode OUTPUT; # This is your OUTPUT stream
while ( read ( $filehandle, $buffer, BUFFERSIZE ) ) {
  print OUTPUT, $buffer;
}
HTH, Alexei

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Krung
Saengpole
Sent: Friday, October 12, 2001 3:34 PM
To: [EMAIL PROTECTED]
Subject: Downloading file.


Hello all,

I have a problem about sending file to user. I made one zip file containing
one text file and send this file to user. User only receives the file but no
content in it. What's wrong I made to this script?

my script:

$file=test.zip;

print HeaderSent;
Content-Type: application/octet-stream; name=$file
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=$file
Expires=0

HeaderSent


TIA.

Krung
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users


___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users