attachinary
attachinary copied to clipboard
Support for private file uploads
CarrierWave supports adding make_private to the attachment. Is that also possible through attachinary?
Relevant url: http://cloudinary.com/blog/how_to_quickly_build_a_stock_photo_site_using_cloudinary
Thanks for the suggestion. I've checked those docs and see that it is possible, but just not currently supported by attachinary. I'll add it to my list. In the mean time, you can fork the project and change the Cloudinary::Uploader.upload call to include type: 'private' option.
I'll be taking this on in a short while.
Any update on this one? I have a need of storing private documents and i am thinking of using carrierwave but attachinary is so much easier to use. With carrierwave i have to create an extra AR model as it will be a has_many documents situation. As a side note, these documents can be anything.. word, pdf, images.. etc.
Yes, attachinary already supports this. You must modify data-form to have the private flag. Also, the attachinary response will tell you if the file uploaded is an image or "raw".
http://cloudinary.com/documentation/upload_images
On Thu, Aug 1, 2013 at 6:57 AM, Karl Baum [email protected] wrote:
Any update on this one? I have a need of storing private documents and i am thinking of using carrierwave but attachinary is so much easier to use. With carrierwave i have to create an extra AR model as it will be a has_many documents situation. As a side note, these documents can be anything.. word, pdf, images.. etc.
— Reply to this email directly or view it on GitHubhttps://github.com/assembler/attachinary/issues/57#issuecomment-21937836 .
Awesome! Once i upload a private file to cloudinary, how can we access it? For example, s3 has an expiring url that i can temporarily give to a user once they have been authorized.
thx!
Try Cloudinary::Utils.cloudinary_url.
https://github.com/cloudinary/cloudinary_gem/blob/master/lib/cloudinary/utils.rb#L211-L218.
@maletor - I see attachinary already takes care of the data-form-data attribute for me. What's the cleanest way to add a configuration parameter to this?
thx!
@maletor - i figured out how to pass the data-form-data attributes. My code looks like:
= f.attachinary_file_field :documents, cloudinary: { type: :private, resource_type: :raw, transformation: :attachment, use_filename: true, image_metadata: true, discard_original_filename: false }
But i get an error back from cloudinary:
{"error":{"message":"Invalid value private for parameter raw_kind"}}
If i remove type:private, it works.
thx!
-karl
Ok, was able to get private uploads working, but not with a raw file type. The following code works when attaching an image:
= f.attachinary_file_field :documents, cloudinary: { type: :private }
But it does not work if i attach a raw file type like an xls document. Along the same lines, the following code, never works as I am explicitly passing in raw:
= f.attachinary_file_field :documents, cloudinary: { type: :private, resource_type: :raw }
I get back the following error from cloudinary:
{"error":{"message":"Invalid value private for parameter raw_kind"}}
thx!