Home>

I want to download the file uploaded to S3 with rails

Completed 500 Internal Server Error in 1011ms (ActiveRecord: 0.3ms | Allocations: 4126)
ArgumentError (path name contains null byte):


Will come out. Please let me know if you know anything. Please(__).

def download
    @notice = Notice.find (params [: id])
    data = open ("https: // bucket name.s3-ap-northeast-1.amazonaws.com/uploads/#{@notice.file.file.filename}")
    send_file (data.read, disposition:'attachment')
end

Reference site

  • Answer # 1

    I could do it normally with send_data. Excuse me.