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

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -