in reply to Overwrite file protection
Hello,
I don't see the point in using '<' and '>' for the filename, inside the for loop.
This do the trick:
if( -e $upload_dir.'/'.$filename2 ){ my $inc = '1'; while( -e $upload_dir . '/' . $filename2 . '~' .$inc ){ $inc++; } # Use "${upload_dir}/${filename2}~${inc}" as the filename. }
Warning: untested code. Please pay attention to possible mispells and errors.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Just Another Perl Monk
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Overwrite file protection
by Willman023 (Scribe) on Jun 16, 2003 at 20:22 UTC | |
by monsieur_champs (Curate) on Jun 16, 2003 at 20:33 UTC | |
by Cody Pendant (Prior) on Jun 16, 2003 at 21:23 UTC | |
by monsieur_champs (Curate) on Jun 17, 2003 at 13:34 UTC |