s3_direct_upload_example
s3_direct_upload_example copied to clipboard
422 Unprocessable Entity on save
The S3 upload is working fine - I can see the files on S3, but the actual save process is failing with
ActiveRecord::RecordInvalid - Validation failed: Direct upload url is invalid:
I'm not sure where to go with this, for me the model is called Import instead of Document and the field for the final file is import_file rather than upload.
The format for me looks like this:
DIRECT_UPLOAD_URL_FORMAT = %r{\Ahttps:\/\/s3\.amazonaws\.com\/#{BUCKET_NAME}\/(?<path>import_files\/.+\/(?<filename>.+))\z}.freeze
Are you possibly using a virtual hosted style URL for your bucket? I.e. bucketname.s3.amazonaws.com rather than a path style URL s3.amazonaws.com/bucketname?