Sha256: c5f0a54b895c0945cd4b09c1f3c5780d5aec4f8dcb0009022fa69161ec4f1f04
Contents?: true
Size: 1.46 KB
Versions: 1
Compression:
Stored size: 1.46 KB
Contents
module S3Multipart class UploadsController < ApplicationController def create begin upload = Upload.create(params) upload.execute_callback(:begin, session) response = upload.to_json rescue response = {error: 'There was an error initiating the upload'} ensure render :json => response end end def update return complete_upload if params[:parts] return sign_batch if params[:content_lengths] return sign_part if params[:content_length] end private def sign_batch begin response = Upload.sign_batch(params) rescue response = {error: 'There was an error in processing your upload'} ensure render :json => response end end def sign_part begin response = Upload.sign_part(params) rescue response = {error: 'There was an error in processing your upload'} ensure render :json => response end end def complete_upload begin response = Upload.complete(params) upload = Upload.find_by_upload_id(params[:upload_id]) upload.update_attributes(location: response[:location]) upload.execute_callback(:complete, session) rescue response = {error: 'There was an error completing the upload'} ensure render :json => response end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
s3_multipart-0.0.8 | app/controllers/s3_multipart/uploads_controller.rb |