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
In reply to Re: Overwrite file protection
by monsieur_champs
in thread Overwrite file protection
by Willman023
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |