user1429496
user1429496

Reputation: 313

Rails 3: How to use original filename for an upload?

I'm following this tutorial to upload and encode videos: http://www.nickdesteffen.com/blog/video-encoding-with-uploadify-carrierwave-and-zencoder

I have the following line in my model:

Zencoder::Job.create({:input => "s3://mybucket/uploads/videos/#{model.id}/video.mp4"

I need to replace the "video.mp4" at the end of this line with the name of the file I upload. How can I accomplish this?

Upvotes: 0

Views: 766

Answers (1)

deefour
deefour

Reputation: 35370

CarrierWave's SanitizedFile has an original_filename method you can use to access the original, unmodified name of the uploaded file.

Zencoder::Job.create({:input => "s3://mybucket/uploads/videos/#{model.id}/#{original_filename}"

Upvotes: 1

Related Questions