CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Intermediate:
Os problem?



Sep 17, 2000, 11:19 PM

Post #1 of 3 (453 views)
Os problem? Can't Post

I'm using a webhosting script, it has tons of options which work perfectly. That is until you come upon the upload part. When something is uploaded (anything other then html, text files and sound files) It's turned into a mess, pictures don't work, zips become corrupted. When I use some very basic scripts uploading works through them. but when I use this one, and other's with more then just an upload option, they seem to do the exact same thing. Anyone have any ideas? Could it be OS related?


Sep 18, 2000, 8:06 AM

Post #2 of 3 (453 views)
Re: Os problem? [In reply to] Can't Post

Some OSes require the use of binmode() if you're writing binary content so that's possibly your problem if binaries are getting hosed (although you say sound files are working, which would go against this theory).

What OS are you using and what's the snippet of code thats processing the incoming file and writing it out?


Sep 18, 2000, 9:36 PM

Post #3 of 3 (453 views)
Re: Os problem? [In reply to] Can't Post

@totalfiles = ();
%filewritten = ();
foreach $key (sort {$a <=> $b} $query->param())
next if ($key =~ /^\s*$/);
next if ($query->param($key) =~ /^\s*$/);
next if ($key !~ /^file-to-upload-(\d+)$/);
$Number = $1;

if ($query->param($key) =~ /([^\/\\]+)$/)
$Filename = $1;
$Filename =~ s/^\.+//;
$File_Handle = $query->param($key);
$FILENAME_IN_QUESTION = $query->param($key);

undef $BytesRead;
undef $Buffer;

while ($Bytes = read($File_Handle,$Buffer,1024))
$BytesRead += $Bytes;
print OUTFILE $Buffer;

push(@Files_Written, "$SAVE_DIRECTORY\/$Filename");

push(@totalfiles, "$Filename");
$TOTAL_BYTES += $BytesRead;
$Confirmation{$File_Handle} = $BytesRead;


This is the code
I'm testing this on Win98, but I'm gonna move it to Win2k Advanced Server. I don't know if that will make it work or not.


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives