uploading video

I was trying to upload a video…but if I click upload button …nothing happens…I was using the same codes whatever I used for uploading picture- codes in model class Picture < ActiveRecord::Base validates_format_of :content_type, with: /^video/, message: “— you can only upload pictures”

def uploaded_picture=(picture_field) self.name = base_part_of(picture_field.original_filename) self.content_type = picture_field.content_type.chomp self.data = picture_field.read end

def base_part_of(file_name) File.basename(file_name).gsub(/[^\w._-]/, ‘’) end end

codes in controller: class UploadController < ApplicationController def get @picture = Picture.new end

. . .

def save @picture = Picture.new(params[:picture]) if @picture.save redirect_to(action: ‘show’, id: @picture.id) else render(action: :get) end end

def show @picture = Picture.find(params[:id]) end

def picture @picture = Picture.find(params[:id]) send_data(@picture.data, filename: @picture.name, type: @picture.content_type, disposition: “inline”) end end

You might find http://filer.io helpful. It's a cloud file storage service that integrates upload and download functionality seamlessly in Rails apps. (disclaimer: I work on Filer.io)