in reply to Re: Uploading files to server
in thread Uploading files to server

ok

#!/usr/local/bin/perl use CGI; $q = new CGI; $file = $q->param('file'); ##### $up = $q->upload("$file"); while (<$up>) { print; } exit:

i have this one , but it aint work, it shows "500 error"

there must be something missing, what??

pics of peolple, "JPG", its for a site About my city, buissnes listing, partys, disco, peolple,

thath kind of stuff

Calilo

Replies are listed 'Best First'.
Re: Re: Re: Uploading files to server
by hopes (Friar) on Oct 15, 2001 at 04:24 UTC
    Hi again,
    try exit; instead exit:
    You have to write html headers too
    It is also recommended to use strict and warnings.
    #!/usr/local/bin/perl -w use CGI; use strict; my $q = new CGI; print $q->header; print $q->start_html("Example"); my $file = $q->param('file'); my $up = $q->upload("$file"); while (<$up>) { print; } exit;
    Last, but not less important, check the permissions. Maybe you shouldn't be able to write.
    Check the error 500 with Netscape. It brings useful information about the error.
    It is probably syntax error

    Hope this help
    Hopes
      oky

      that worked thanks alot

      now if im correct i only have to add a part that copys the

      file to a safe place so is'nt deleted after uploaded, right??

      # Read a text file and print it out while (<$file>) { print; } # Copy a binary file to somewhere safe open (OUTFILE,">>/usr/local/web/users/feedback"); while ($bytesread=read($file,$buffer,1024)) { print OUTFILE $buffer; }
      am i right????

      Calilo

      thanks alot hopes