# File lib/carrierwave/storage/cloud_files.rb, line 81 def content_type cf_container.object(@path).content_type end
# File lib/carrierwave/storage/cloud_files.rb, line 85 def content_type=(new_content_type) headers["content-type"] = new_content_type end
Remove the file from Cloud Files
# File lib/carrierwave/storage/cloud_files.rb, line 61 def delete cf_container.delete_object(@path) end
Returns the current path/filename of the file on Cloud Files.
A path
# File lib/carrierwave/storage/cloud_files.rb, line 41 def path @path end
Reads the contents of the file from Cloud Files
contents of the file
# File lib/carrierwave/storage/cloud_files.rb, line 52 def read object = cf_container.object(@path) @content_type = object.content_type object.data end
Writes the supplied data into the object on Cloud Files.
boolean
# File lib/carrierwave/storage/cloud_files.rb, line 96 def store(data,headers={}) object = cf_container.create_object(@path) object.write(data,headers) end
Returns the url on the Cloud Files CDN. Note that the parent container must be marked as public for this to work.
file’s url
# File lib/carrierwave/storage/cloud_files.rb, line 73 def url if @uploader.cloud_files_cdn_host "http://" + @uploader.cloud_files_cdn_host + "/" + @path else cf_container.object(@path).public_url end end
# File lib/carrierwave/storage/cloud_files.rb, line 28 def initialize(uploader, base, path) @uploader = uploader @path = path @base = base end