How to get CGI upload temp filename and directory

Discussion in 'Perl Misc' started by blaine@worldweb.com, Sep 30, 2005.

  1. Guest

    Hello,

    How can I get the tempory directoy and name of a file uploaded using
    CGI?


    Assuming www is a CGI object then the following works. However it's not
    what I'm looking for.

    You can get the file handle by going
    $www->upload($filename);

    And the original filename by going
    $www->param($filename);

    I would like something like
    $www->uploadInfo($filename)->{temporary_upload_path};
    , Sep 30, 2005
    #1
    1. Advertising

  2. Guest

    wrote:
    > Hello,
    >
    > How can I get the tempory directoy and name of a file uploaded using
    > CGI?
    >
    >
    > Assuming www is a CGI object then the following works. However it's not
    > what I'm looking for.
    >
    > You can get the file handle by going
    > $www->upload($filename);
    >
    > And the original filename by going
    > $www->param($filename);
    >
    > I would like something like
    > $www->uploadInfo($filename)->{temporary_upload_path};



    Try the undocumented(?) tmpFileName subroutine.

    use CGI qw:)standard);
    use File::Basename;
    my $fh = upload('uploaded_file');
    my $fullname = tmpFileName($fh);
    my $tmp_dir = dirname($fullname);

    --
    Hope this helps,
    Steven
    , Sep 30, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    2
    Views:
    571
    Mark P
    May 9, 2005
  2. Replies:
    1
    Views:
    1,467
    Roland de Ruiter
    Jun 15, 2006
  3. Najd

    Get user Temp directory

    Najd, Apr 13, 2006, in forum: C++
    Replies:
    6
    Views:
    1,157
  4. A. Farber
    Replies:
    3
    Views:
    256
    Ben Morrow
    Mar 3, 2004
  5. PerlFAQ Server
    Replies:
    0
    Views:
    259
    PerlFAQ Server
    Apr 26, 2011
Loading...

Share This Page