Kibashira has asked for the wisdom of the Perl Monks concerning the following question:
I am running an Apache server on a networked machine and want to allow people browsing the intranet on that machine to copy files from their machines to a specified dir on the server machine.
I am using "multipart/form-data" encoding to get the filename and pass this to the routine. The only problem is that this returns a local path to the file on the user's machine and when they're looking at the intranet (which runs on HTTP://GIOTTO) in their browsers, this is not the path to the file relative to the CGI routine that is running the FILE::COPY. I have tried frigging it but no luck.
Also, FILE::COPY itself seems to return very little info. At the moment I am using the following code (where "recourse" is the dir I want the files to be uploaded to):
Does anyone have any pearls of wisdom on this one?$filename = $formdata{file}; @parts = split (/\\/,$filename); $sourcefilename = @parts[$#parts]; $targetdir = "\\\\\Giotto\\recourse"; $targetfilename = "$targetdir\\$sourcefilename"; print "The target directory for this file is: $targetdir"; print "This makes the target path: $targetfilename"; use File::Copy; if (copy $filename, $targetfilename) { print "Copy complete..."; } else { print "Error"; }
2002-05-03 Edit by Corion : Added formatting
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: File::Copy across a Network
by tachyon (Chancellor) on May 03, 2002 at 11:58 UTC | |
by Anonymous Monk on May 03, 2002 at 16:23 UTC | |
by tachyon (Chancellor) on May 04, 2002 at 05:40 UTC | |
|
Re: File::Copy across a Network (or rather: File Upload with HTTP/CGI)
by bjelli (Pilgrim) on May 03, 2002 at 11:45 UTC |