# this code is to attach a photo from the tmp directory def attachtmpcontactphoto if @a_viewnamedata $currentnametext = @a_viewnamedata end if $currentnametext tmpcontactphotoName = $tmpphoto_directory + "/" + @a_tmpphotoname begin if File.exist?(tmpcontactphotoName) newcontactphotoName = $tmpphoto_directory + "/" + $currentnametext + ".jpg" if ! (tmpcontactphotoName == newcontactphotoName ) File.rename(tmpcontactphotoName, newcontactphotoName) end @listphotosfromtmp = "Photo attached" FileUtils.cp(newcontactphotoName , $addressfiles_directory) else @listphotosfromtmp = "attachment failed" end rescue @listphotosfromtmp = "attachment failed" end end end