def downloadAndSaveFile( dbid, rid, fid, filename = nil, vid = "0"  )
      response, fileContents = downLoadFile( dbid, rid, fid, vid )
      if fileContents and fileContents.length > 0
         if filename and filename.length > 0
            Misc.save_file( filename, fileContents )
         else
            record = getRecord( rid, dbid, [fid] )
            if record and record[fid] and record[fid].length > 0
               Misc.save_file( record[fid], fileContents )
            else
               Misc.save_file( "#{dbid}_#{rid}_#{fid}", fileContents )
            end
         end
      end
   end
def downloadAndSaveFile( dbid, rid, fid, filename = nil, vid = "0"  )
      response, fileContents = downLoadFile( dbid, rid, fid, vid )
      if fileContents and fileContents.length > 0
         if filename and filename.length > 0
            Misc.save_file( filename, fileContents )
         else
            record = getRecord( rid, dbid, [fid] )
            if record and record[fid] and record[fid].length > 0
               Misc.save_file( record[fid], fileContents )
            else
               Misc.save_file( "#{dbid}_#{rid}_#{fid}", fileContents )
            end
         end
      end
   end
Download and save a file from a file attachment field in QuickBase.
 Use the filename parameter to override the file name from QuickBase.