def self.generate_unique_filename(complete_file_path_without_ext,extension)
md5_str=""
finished=false
until finished
md5 = Digest::MD5.new
now = Time.now
md5 << now.to_s
md5 << String(now.usec)
md5 << String(rand(0))
md5 << String($$)
md5.hexdigest
if(Fusioncharts::Exporter::Properties.FILESUFFIXFORMAT=="TIMESTAMP")
md5_str = md5.to_s + "_" + Time.now.strftime("%m%d%Y%S").to_s
else
md5_str = md5.to_s + "_" + Array.new(9){rand 10}.join
end
finished=!FileTest.exists?(complete_file_path_without_ext+md5_str+"."+extension)
end
return complete_file_path_without_ext+md5_str + "." + extension
end