I know that this has been asked before but I couldn't find it in the 
digest.  

I want to upload a file and for what ever reason I am unable to.  I have 
written and tested code to
upload a file but when that same sub function is called inside a run 
mode the file is not passed.
If there is a better way I am very interested in learning it.  I am a 
very basic programmer.

Here is the code:

This is the upload function that I am calling to upload the file.  This 
works when run outside of a CGI::App situation:
sub UploadFile
{
    my $filePath = shift;

    # Take the C:\whatever junk or the /something/somthing out of it and 
keep just the filename
    if ($filePath =~ /([^\/\\]+)$/)
    {
        my $fileName = $1;
    }
    else
    {
        my $fileName = $filePath;
    }
 
    # Where to save the file
    my $writeFile = "$filePath";

    # Open the file to
    if (open(FILE,">$writeFile"))
    {
        # Upload the file
        while (my $bytesRead=read($filePath,my $buff,2096))
        {
            my $size += $bytesRead;
            binmode FILE;
            print FILE $buff;
        }
        # Close the file to upload
        close(FILE);

        return 1;
    }
    else
    {
        return 0;
    }
}

How should I do this?

-- 
Thanks,
Kenny Pyatt
Owner
Design Shack
www.dshack.com



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to