LMPX.COM |
Home | Linux | Mysql | PHP | XML | ||
|
|
|||
From: J Alejandro Ceballos Z Date: Sun Jun 21 23:51:10 2009 Subject: Re: Storing a file from a cgi parameter
As I understand, the code must be overwritten like:
#!/usr/bin/perl -T
use CGI::UploadEasy;
use CGI;
use strict;
use warnings;
# create and load data
my $ue = CGI::UploadEasy->new(-uploaddir => '~/tmp');
my $file_file = $cgi_this->param('sbvideo_file') || 0;
# retrieve original name and change it
if ($file_file =~ /(.+)\.(\w+)$/)
{ ($str_filename,$str_fileext) = ($1,$2); }
$str_filename = $$ . '.'. $str_fileext;
# STORE???
# is this line Ok? To assign directly the file to that address?
$ue->fileinfo = $file_file;
#Now. How I change the name of the stored file to the new one of
$str_filename
I need to validate some data from the parameter, and change other,
like the name of the file, that is why I use CGI and CGI::UploadEasy,
There is some example? Not only the CPAN documentation in order to
check it?
J Alejandro Ceballos Z wrote:
> I am trying to store a file in the temp directory.
> It creates the desired file, but with size 0.
> The files are videos sent via CGI. I tried with the upload function,
> but it did not work too.
> Would you please give me some direction about what I am doing wrong
> or what should I do in order to make it work?
I suggest that you try the CGI::UploadEasy module.
http://search.cpan.org/dist/CGI-UploadEasy/
Atentamente,
J. Alejandro Ceballos Z.
| Navigate in group perl.beginners.cgi at sever nntp.perl.org | |
| Previous | Next |
| © No Copyright You are free to use Anything |
Site Maintained by Zareef Ahmed
Powered By PHP Consultants |