frank1 has asked for the wisdom of the Perl Monks concerning the following question:
am trying to rename files and then upload, the problem am facing is that file rename and shows 0, but file size remains same. the problem the file rename and change file extension, and i want to keep file extension i just want to rename only file and leave extension alone
use CGI; use CGI::Carp qw ( fatalsToBrowser ); use File::Basename; my $upload_dir = "upload/"; my $query = new CGI; my $filename = $query->param("file"); my $upload_filehandle = $query->upload("file"); my $newname = "edddd"; my $fileto = rename($filename, $newname); open ( UPLOADFILE, ">$upload_dir/$fileto" ) or die "$!"; binmode UPLOADFILE; while ( <$upload_filehandle> ) { print UPLOADFILE; } close UPLOADFILE;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: rename file
by kcott (Archbishop) on Aug 25, 2020 at 11:06 UTC | |
by jcb (Parson) on Aug 26, 2020 at 01:26 UTC | |
by kcott (Archbishop) on Aug 26, 2020 at 05:47 UTC | |
|
Re: rename file
by perlfan (Parson) on Aug 24, 2020 at 17:40 UTC | |
by AnomalousMonk (Archbishop) on Aug 24, 2020 at 19:30 UTC | |
by perlfan (Parson) on Aug 24, 2020 at 19:35 UTC | |
by marto (Cardinal) on Sep 03, 2020 at 08:16 UTC | |
by haukex (Archbishop) on Aug 24, 2020 at 18:57 UTC | |
by perlfan (Parson) on Aug 24, 2020 at 19:40 UTC | |
by AnomalousMonk (Archbishop) on Sep 03, 2020 at 07:42 UTC | |
by frank1 (Monk) on Aug 24, 2020 at 17:59 UTC | |
by AnomalousMonk (Archbishop) on Sep 03, 2020 at 16:47 UTC | |
|
Re: rename file
by bigup401 (Pilgrim) on Aug 24, 2020 at 18:08 UTC | |
by Fletch (Bishop) on Aug 24, 2020 at 22:28 UTC | |
by frank1 (Monk) on Aug 24, 2020 at 18:13 UTC |