Displaying 1 result from an estimated 1 matches for "new_file_name".
Did you mean:
a_new_file_name
2006 Jan 09
1
Saving an upload
....local_path, destfile
#assert File.exists?(destfile), "File upload failed"
end
end
def uploaded_file=(incoming_file)
self.filename = incoming_file.original_filename
self.content_type = incoming_file.content_type
@temp_file = incoming_file
end
def filename=(new_file_name)
write_attribute("filename", sanitize_filename(new_file_name))
end
private
def sanitize_filename(file_name)
# get only the filename, not the whole path (from IE)
just_filename = File.basename(file_name)
# replace all non-alphanumeric, underscore or periods with
un...