Hi, I am stumpted and submit myself to your mercy. I suspect my problem may be with my browser but I cannot pass a file upload parameter to my cgi script with the full directory path. The file parameter is always local to my cgi-bin and not the full path the documentation implies it should be. The code works in netscape 6. Any ideas? Thanks AA
#!/usr/bin/perl -w -T use strict; use CGI; my $entrypg=new CGI; print $entrypg->header, $entrypg->start_html( -title => "Load your file", -BGCOLOR => 'white', -LINk => 'red' ), $entrypg->center($entrypg->h1("Upload annotation file")), $entrypg->start_multipart_form( -name=>'form', -method=>'POST', -action=>'http://xyz.co.uk/cgi-bin/Parse.cgi' ), $entrypg->table( {-border=>'1', -align=>'CENTER', -cellspacing=> '1', -cellpadding=>'1', }, $entrypg->TR( {-colspan=>'2'}, "Please choose your file:" ), $entrypg->TR( $entrypg->td($entrypg->filefield( -name=>'INPUT', -size=>'50' ) ) ) ), $entrypg->submit, $entrypg->reset;
and Parse.cgi=
#!/usr/bin/perl -w -T use strict; use CGI; use Data::Dumper; use XML::Parser; my $xmlpg = new CGI; my $file = $xmlpg->param("INPUT"); my ($ID,$from, $to); my $p =new XML::Parser(Style=>'Tree'); my $doc = $p->parsefile("$file"); #print Dumper($doc); my $level =0; process_node(@$doc); sub process_node { my ($type, $content) = @_; if ($type eq 'id') { $ID = trim($content->[2]); } elsif ($type eq 'from') { $from = trim($content->[2]); } elsif ($type eq 'to') { $to = trim($content->[2]); } if ($type) { while (my @node = splice @$content, 1, 2) { process_node(@node) } } } sub trim { local $_ = shift; s/\n/ /g; s/^\s+//; s/\s+$//; return $_; } print $xmlpg ->header, $xmlpg->start_html( -title => "XML File", -BGCOLOR => 'white', -LINk => 'red' ), $xmlpg->h1("Looking at $ID which starts at $from and finishes at + $to");

In reply to CGI, file upload and netscape 7 by aging acolyte

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.