ruby on rails - File rename while uploading -
i uploading files amazon s3 rails app , working fine, however, want know how can append string file uploaded. example if user has chosen file abc.jpg, need append header_abc.jpg. how can achieve this?
path = picture.attachment.path() new_file_name = "header_" + picture.attachment_file_name fileutils.move(path, file.join(file.dirname(path), new_file_name)) picture.attachment_file_name = new_file_name picture.save
Comments
Post a Comment