<?xml version="1.0" encoding="windows-1252"?>
<node id="551335" title="Re: How to upload file without using FTP?" created="2006-05-24 07:39:37" updated="2006-05-24 03:39:37">
<type id="11">
note</type>
<author id="533863">
roboticus</author>
<data>
<field name="doctext">
madtoperl:&lt;p&gt;
A couple of things:  First, in the code you've shown, you've forgotten to set &lt;code&gt;$upload_dir&lt;/code&gt;, so your open may be failing because of that.  Secondly, your regular expression is missing a character.  I think you meant this:&lt;p&gt;
&lt;code&gt;
    s/([^\/\\]+)$//;
&lt;/code&gt;
But after seeing what you're doing, I'd simplify and rearrange the filename parsing bit to look like this:&lt;p&gt;
&lt;code&gt;
    my ($drive, $path, $file);
    die "Invalid file name!"
        unless $file_query1 =~ /(\w:)?(.+)[\\\/](.*)/;
    print "Drive=", $1, ", Path=", $2, ", File=", $3, "\n";
&lt;/code&gt;
In any case, I'd second [id://483556]'s suggestion.  I've used Net::FTP and it works nicely for jobs like this.&lt;p&gt;
--roboticus</field>
<field name="root_node">
551303</field>
<field name="parent_node">
551303</field>
</data>
</node>
