Upload Not Working 
Author Message
 Upload Not Working

I am trying to use CGI to upload a file from my PC onto a UNIX based
webserver.  I appear to be following the examples but for some reason
while I can retrieve the filename, I cannot retrieve its contents.  I've
tried this on both Netscape 4.5 and IE 4.0.

I have the example code below.

Any assistance would be most appreciated.

Chris

#!/opt/automation/td/perl/bin/perl

use CGI;

$query = new CGI;

print $query->header;
print $query->start_html( "Upload Form" );
&print_prompt( $query );
&do_work( $query );
print $query->end_html;

sub print_prompt
{

  print $query->startform;

  print "<P><EM>Which File?</EM><BR>";
  print $query->filefield( -name=>'uploaded_file',
                           -default=>'starting value',
                           -size=>50,
                           -maxlength=>80 );

  print "<P>\n";
  print $query->submit('Action','Upload File');

  print "<HR>\n";

  print $query->endform;

Quote:
}

sub do_work
{

  my $file = $query->param( 'uploaded_file' );
  print "<H3> file contents of $file <H3>\n";

  $query->binmode();
  while( <$file> )
  {
     chop;
     print "line: ", $_, "<BR>\n";
  }
  print "<HR>\n";

Quote:
}

--
Chris Forlano
Automation Development
Nortel Networks, Maidenhead
590 4342 (01628 434 342)



Mon, 23 Dec 2002 03:00:00 GMT  
 Upload Not Working
I am trying to use CGI to upload a file from my PC onto a UNIX based
webserver.  I appear to be following the examples but for some reason
while I can retrieve the filename, I cannot retrieve its contents.  I've
tried this on both Netscape 4.5 and IE 4.0.

I have the example code below.

Any assistance would be most appreciated.

Chris

#!/opt/automation/td/perl/bin/perl

use CGI;

$query = new CGI;

print $query->header;
print $query->start_html( "Upload Form" );
&print_prompt( $query );
&do_work( $query );
print $query->end_html;

sub print_prompt
{

  print $query->startform;

  print "<P><EM>Which File?</EM><BR>";
  print $query->filefield( -name=>'uploaded_file',
                           -default=>'starting value',
                           -size=>50,
                           -maxlength=>80 );

  print "<P>\n";
  print $query->submit('Action','Upload File');

  print "<HR>\n";

  print $query->endform;

Quote:
}

sub do_work
{

  my $file = $query->param( 'uploaded_file' );
  print "<H3> file contents of $file <H3>\n";

  $query->binmode();
  while( <$file> )
  {
     chop;
     print "line: ", $_, "<BR>\n";
  }
  print "<HR>\n";

Quote:
}

--
Chris Forlano
Automation Development
Nortel Networks, Maidenhead
590 4342 (01628 434 342)



Mon, 23 Dec 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. file upload not working anymore

2. File UPLOAD not working with NetScape

3. file upload works in Netscape but not IE

4. Uploading PC files works - but not Mac files

5. Send mail script not working in 2nd server but working in 1st server

6. Send mail script not working in 2nd server but working in 1st server

7. DBD::XBase 'not' not working

8. My multi upload script isnt working right...

9. File Upload Temp file not deleted

10. Upload with browser even when file not there

11. Apache - CGI File Uploads don't work

12. Can't get upload working properly

 

 
Powered by phpBB® Forum Software