jnicklas/carrierwave — Issue #559: Rails Carrier Wave and JQuery Uploader to Amazon S3
Author: kingpangilinan
Created: 2011-12-15 19:29:48+00:00
State: open

Gooday...

I am trying to implement the multiple uploading to Amazon S3 (https://github.com/jnicklas/carrierwave/blob/master/README.md) (under Using Amazon S3)

But I got an error inside log file:
```
Started POST "/images?project_id=18" for 124.106.90.29 at Wed Dec 14 19:11:47 -0600 2011
Processing by ImagesController#create as JS
Parameters: {"project_id"=>"18", "authenticity_token"=>"9z0CzTtMwxgfdsyFLCNzx44qqRDT8F7+6F/RsVzUe4=", "utf8"=>"✓", "image"=>{"carimage"=>#, @original_filename="stroke_holding.jpg">, "project_id"=>"18"}}
[1m[35mProject Load (0.2ms)[0m SELECT `projects`.* FROM `projects` WHERE `projects`.`id` = 18 LIMIT 1
[1m[36m (0.1ms)[0m [1mBEGIN[0m
[1m[35mSQL (1.2ms)[0m INSERT INTO `images` (`caption`, `carimage`, `created_at`, `proj_photo_content_type`, `proj_photo_file_name`, `proj_photo_file_size`, `proj_photo_updated_at`, `project_id`, `updated_at`) VALUES (NULL, 'stroke_holding.jpg', '2011-12-15 01:11:48', NULL, NULL, NULL, NULL, 18, '2011-12-15 01:11:48')
[1m[36m (1.7ms)[0m [1mROLLBACK[0m
Completed 500 Internal Server Error in 2635ms

Excon::Errors::MovedPermanently (Expected(200) <=> Actual(301 Moved Permanently)
request => {:port=>"443", :method=>"PUT", :idempotent=>true, :body=>#, :headers=>{"Authorization"=>"AWS XXXXXXXXXXXXXXXXXXXXXXXXXXXXX:XXX/XXXXXXXXXXXXXXXXXXX=", "x-amz-acl"=>"public-read", "Date"=>"Thu, 15 Dec 2011 01:11:48 +0000", "Content-Type"=>"image/jpeg", "Content-Length"=>64387, "Host"=>"sample.s3-eu-west-1.amazonaws.com:443"}, :host=>"sample.s3-eu-west-1.amazonaws.com", :query=>nil, :connect_timeout=>60, :expects=>200, :read_timeout=>60, :scheme=>"https", :write_timeout=>60, :path=>"/stroke_holding.jpg", :mock=>nil}
response => #\nPermanentRedirectThe bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.2990AE131EF6DCE2sampleq+XXXXXXXXXXXXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXs3.amazonaws.com", @status=301, @headers={"x-amz-id-2"=>"q+XXXXXXXXXXXXXXXXXXXXXXXXXXXXX/XXXXXXXXXXXXXXXXXXX", "Transfer-Encoding"=>"chunked", "Date"=>"Thu, 15 Dec 2011 01:11:49 GMT", "Content-Type"=>"application/xml", "x-amz-request-id"=>"2990AE131EF6DCE2", "Server"=>"AmazonS3", "Connection"=>"close"}>):
app/controllers/images_controller.rb:37:in `create'

Rendered vendor/bundle/ruby/1.8/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.4ms)
Rendered vendor/bundle/ruby/1.8/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (1.0ms)
Rendered vendor/bundle/ruby/1.8/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (4.4ms)
```
Here is my line 37 in images controller:
```
def create
@image = Image.new(params[:image])
if @image.save #line 37
render :json => [@image.to_jq_upload].to_json
end
end
```

I also get something like this in error console:

```
Error: not well-formed
Source File: https://s3-console-us-standard.console.aws.amazon.com/DeliverHttp
Line: 1, Column: 1
Source Code:
{
```

# I also posted this in [http://stackoverflow.com/questions/8514247/rails-carrier-wave-and-jquery-uploader-to-amazon-s3](http://stackoverflow.com/questions/8514247/rails-carrier-wave-and-jquery-uploader-to-amazon-s3)