Thanks guys, the error is that the directory of filename does not exist - this is in reponse to the die statement.
Im guessing now that die isnt dandled by browsers and thats why I got the 500 error, Anyway....
This is my code -
#!/usr/local/bin/perl use strict; use CGI; my $query = new CGI; my $dir = $query->param('dir'); my $file = $query->param('file'); $file =~m/^.*(\\|\/)(.*)/; my $name = $2; open(LOCAL,">$dir/$name");# or die "Die: $!"; while(<$file>) { print LOCAL $_; } print $query->header(); print $query->start_html("File Upload"); # DEBUG TO SCREEN print "File and Dir: "$file; print "File: ",$name; print $query->end_html;
THe program prints -
File and Dir: C:\Documents and Settings\Barry Griffin\Desktop\verbs.tx +t File: verbs.txt
The directory and file are located on my local machine, so i've no idea why I might be getting this error - im working on XP. ANy ideas?

In reply to Re: Re: using die by Baz
in thread using die in CGI context / 500 errors by Baz

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.