#!C:\Perl\bin\perl.exe -w use CGI; use Net::FTP; my $q = new CGI; my $thefile = $q->param('filename'); $dir = 'S:/Free'; $ftpobj = Net::FTP -> new ("192.168.0.2"); $ftpobj -> login("cms","cm5u53r"); $ftpobj -> binary; $ftpobj -> put ("$dir\\$thefile"); $ftpobj -> quit; print "Content-type: text/html\n\n"; print "\n<html><head>"; print "<title>Uploading Complete</title>"; print "</head>"; print "<body><h2>Uploading Complete</h2><br><br>filename: [$filename] +thefile: [$thefile]<br><br>"; print "</body></html>";
this script, although it looks correct in syntax gives me a weird result. When running the script from command line the directory passes correctly, but when running it with a web browser through cgi I get the following: Cannot open local file S:\\Free\\name.ts: no such file or directory. I've tried simpler versions of the same code with chdir and such, but I get the same result... Can anyone help?

In reply to Bug in perl? by MaxDes

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.