Merge pull request #4 from ignisf/carrierwave-filename-validation
Allow only jp(e)g and png uploads
This commit is contained in:
commit
f7575149cd
|
@ -1,5 +1,3 @@
|
||||||
# encoding: utf-8
|
|
||||||
|
|
||||||
class PictureUploader < CarrierWave::Uploader::Base
|
class PictureUploader < CarrierWave::Uploader::Base
|
||||||
|
|
||||||
# Include RMagick or MiniMagick support:
|
# Include RMagick or MiniMagick support:
|
||||||
|
@ -38,9 +36,9 @@ class PictureUploader < CarrierWave::Uploader::Base
|
||||||
|
|
||||||
# Add a white list of extensions which are allowed to be uploaded.
|
# Add a white list of extensions which are allowed to be uploaded.
|
||||||
# For images you might use something like this:
|
# For images you might use something like this:
|
||||||
# def extension_white_list
|
def extension_white_list
|
||||||
# %w(jpg jpeg gif png)
|
%w(jpg jpeg png)
|
||||||
# end
|
end
|
||||||
|
|
||||||
# Override the filename of the uploaded files:
|
# Override the filename of the uploaded files:
|
||||||
# Avoid using model.id or version_name here, see uploader/store.rb for details.
|
# Avoid using model.id or version_name here, see uploader/store.rb for details.
|
||||||
|
|
Loading…
Reference in New Issue