Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Perl Misc (http://www.velocityreviews.com/forums/f67-perl-misc.html)
-   -   How to get CGI upload temp filename and directory (http://www.velocityreviews.com/forums/t894493-how-to-get-cgi-upload-temp-filename-and-directory.html)

blaine@worldweb.com 09-30-2005 05:49 PM

How to get CGI upload temp filename and directory
 
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};


attn.steven.kuo@gmail.com 09-30-2005 08:59 PM

Re: How to get CGI upload temp filename and directory
 
blaine@worldweb.com 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



All times are GMT. The time now is 02:57 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.