<kbd>$formdata{file}</kbd> ? could it be that you are disregarding the three rules of cgi-programming ?

  1. thou shalt use CGI.pm
  2. thou shalt use CGI.pm
  3. thou shalt use CGI.pm

Another point: I think you have mixed up file upload via HTTP and copying across a network. if you are using a browser to upload, you do not need to copy the file across the network from your perl script. it's already on your webserver, in a temporary file, it was transferred via HTTP.

Try this:

use CGI; use strict; my $query = new CGI; if ( $query->upload('file') ) { my ($fh,$info,$sourcefilename,$targetdir); my ($targetfilename, $type); $fh = $query->upload('file'); $info = $query->uploadInfo($fh)->{'Content-Disposition'}; $sourcefilename = "somefile.dat"; if ($info =~ m/filename="(.*?)"/) { $sourcefilename = $1; } $type = $query->uploadInfo($fh)->{'Content-Type'}; $targetdir = "\\\\Giotto\\recourse"; $targetfilename = "$targetdir\\$sourcefilename"; print "<p>The target directory for this file is: $targetdir"; print "<br>The info about this upload field was: $info"; print "<br>The original filename was : $sourcefilename"; print "<br>The type was : $type"; print "<br>This makes the target path: $targetfilename"; open(OUT, ">$targetfilename"); binmode($fh); while(<$fh>) { print OUT; } close OUT; }

On my (Win98) Machine I get the following output:

The target directory for this file is: \\Giotto\recourse
The info about this upload field was: form-data; name="file"; filename="Artistic.txt"
The original filename was : Artistic.txt
The type was : text/plain
This makes the target path: \\Giotto\recourse\Artistic.txt

--
Brigitte    'I never met a chocolate I didnt like'    Jellinek
http://www.horus.com/~bjelli/         http://perlwelt.horus.at

In reply to Re: File::Copy across a Network (or rather: File Upload with HTTP/CGI) by bjelli
in thread File::Copy across a Network by Kibashira

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.