File upload error

2001-12-21 Thread Alexei Danchenkov

Hello, All,
This might be a bit offtopic, but while uploading a file to a server,
all zeros (0x0) are replaced with spaces (0x20). What is wrong with
the following code then or what's wrong with the server configuration?
I am using HTML::Mason with Apache server 1.3.22 under RedHat Linux 6.2
When I am doing the same on the Win32 (local devel machine, no problem
occurs).

# UPLOADING IMAGE
if ( my $upload = $r->upload ) {
  $url = $upload->filename;
  $url =~ s/((?:[^\/\\]*?[\/\\]*?)*)([\w\s\.\[\]]*$)/$2/;
  my $fh = $upload->fh;
  my $buffer = "";
  my $fullpath = $ENV{"DOCUMENT_ROOT"}; # w/o trailing slash
  $fullpath =~ s/docs.*/images\//; # adding missing slash
  my $bytesread = 0;
  if ( sysopen OUTPUT, $fullpath . $url, O_CREAT | O_WRONLY | O_EXCL ) {
binmode $fh;
binmode OUTPUT;
while ( my $bytes = sysread( $fh, $buffer, 65536 ) ) {
  syswrite( OUTPUT, $buffer );
  $bytesread += $bytes;
}
close OUTPUT;
  } else { $m->out( "Couldn't open " . $fullpath . $url ); }
} # END UPLOADING

Alexei
mailto:[EMAIL PROTECTED]

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



RE: Compilation

2001-10-14 Thread Alexei Danchenkov

Hello, Randy and All,
I still can't compile mod_perl from source. I can compile other Perl modules
without problems, whether they are completely built on Perl or contain C/C#
modules (.xs). However, I still can't compile mod_perl with the same error
(see below), whatever I tried. I can install it with ppm, but now I have a
problem since I want to install it on the local network, which doesn't have
any connection to the Internet and apparently never will.
>D:\Modules\mod_perl-1.26>nmake install
>
>Microsoft (R) Program Maintenance Utility   Version 6.00.8168.0
>Copyright (C) Microsoft Corp 1988-1998. All rights reserved.
>
>makefile(531) : fatal error U1035: syntax error : expected ':' or '='
separator
>Stop.
>

-Original Message-
From: Randy Kobes [mailto:[EMAIL PROTECTED]]
Sent: Friday, October 12, 2001 6:12 PM
To: Alexei Danchenkov
Cc: mod_perl Users List
Subject: Re: Compilation


On Fri, 12 Oct 2001, Alexei Danchenkov wrote:

> Hello, All,
>
> This might be a newbie question, but I get this error when trying to link
> mod_perl for Win32:
>
> >D:\Modules\mod_perl-1.26>nmake install
> >
> >Microsoft (R) Program Maintenance Utility   Version 6.00.8168.0
> >Copyright (C) Microsoft Corp 1988-1998. All rights reserved.
> >
> >makefile(531) : fatal error U1035: syntax error : expected ':' or '='
> separator
> >Stop.

This can be a sign that 'perl Makefile.PL' is creating a
Makefile that nmake doesn't like. Does
 perl -V:make
report make='nmake'? If not, edit the "make=..." line in
Perl's Config.pm. If this line is OK, can you build other
extensions?

best regards,
randy kobes


___
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