Your form tag should look something like this:

<form enctype="multipart/form-data" action="results.pl" method="post">

That's probably not your only problem - but you'll need the enctype stuff to upload a file properly.

Also - you seem a little unclear about how CGI works. A CGI script runs on the SERVER. Your browser runs on the CLIENT. If you're running your own web server, "localhost", then client and server are the same - but that's normally not the case. The scripts don't run as you (i.e., not as your user id), but instead as the web server's user id (usually 'nobody' or 'www-user'). In general, a script running on the server has no way to see files on your local (client) file system, and even if it could, it would not have permission to do anything to them (giving the web server user the ability to do so is a huge security risk - don't do it!).

The way to do it correctly is upload the file (from client to server). The server will need a directory that it has permission to write into, so it can save the upload. Then you can process it however you like.


In reply to Re^5: Upload file (PDB format ) on server by scorpio17
in thread Upload file (PDB format ) on server by flyPerl

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.