You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What steps will reproduce the problem?
1.Send any attachment with the same name
What is the expected output? What do you see instead?
The system should change the file name. The system overwrites existing files
with the same name.
Please provide any additional information below.
I added the following function to the system to fix the issue. I am still
learning so the code may not be perfect, but it works great.
public function checkFileName($filename){
$fullFileName = dirname( __FILE__ ).'/save_dir/'.$filename;
if(file_exists($fullFileName)){
$exists='1';$check='';
$splitFile = explode('.',$filename);
$count = count($splitFile);
$counter = $count-1;;
$piece = $splitFile[$counter];
$file='';
for($i=0;$i<$count-1;$i++){
$file.=$splitFile[$i];
}
$i='1';
while($exists='1'){
$check = $file.'('.$i.').'.$piece;
$name=dirname( __FILE__ ).'/save_dir/'.$check;
if(!file_exists($name)){break;}
else{$i++;}
}
$filename=$check;
}
return $filename;
}
Original issue reported on code.google.com by [email protected] on 24 Apr 2013 at 6:02
The text was updated successfully, but these errors were encountered:
Original issue reported on code.google.com by
[email protected]
on 24 Apr 2013 at 6:02The text was updated successfully, but these errors were encountered: