FriendsOfCake / cakephp-upload

CakePHP: Handle file uploading sans ridiculous automagic
https://cakephp-upload.readthedocs.io/
MIT License
551 stars 255 forks source link

Having problem when using column name 'type' #500

Closed azrulharis closed 5 years ago

azrulharis commented 5 years ago

Hi,

I have sql column name 'type' tinyint to store some information, but the value being overwritten to store Mime Type (application/pdf, image/jpg etc).

Any idea to keep the original value?

Thanks in advance

sdevore commented 5 years ago

look at the examples in the documentation. https://cakephp-upload.readthedocs.io/en/latest/examples.html. you can override the default fields also referenced from here http://josediazgonzalez.com/2015/12/05/uploading-files-and-images/.

azrulharis commented 5 years ago

Thanks @sdevore

By replace type to mime field, it working

public $actsAs = array( 'Upload.Upload' => array( 'attachment' => array(
'fields' => array( 'dir' => 'dir', 'type' => 'mime' ) ) ) );

Thanks again