How to do form-based file uploads in CakePHP?

前端 未结 3 1185
眼角桃花
眼角桃花 2021-02-06 18:04

I have been looking into this for a while and can\'t figure it out. Basically I have an add page for my model which you can add a map from a URL or from a file upload. I have go

3条回答
  •  遥遥无期
    2021-02-06 18:32

    NOTE: MeioUploadBehavior has been deprecated. Instead jrbasso suggests the Upload Plugin.

    In addition to the fine answers already given I want to hint about MeioUploadBehavior, currently maintained by jrbasso at github, which has been a great help for me in my own CakePHP project.

    You simply add the behavior to your model using the $actsAs field and at the same time specifying any custom preferences. Then create necessary fields (described by supplied docs in detail) in your database, or configure the model to not use any database table. Finally setup the form in your add page, also described in the supplied documentation. The behavior will then take care of the rest for you.

提交回复
热议问题