[FIX] saveas_ajax: get correct filename (fixes #1239)

This patches fixes #1239 by fetching the filename field value from the record or defaults even if the file data was already sent with the request.