如何在敏捷工具包4.2中使用文件上传 [英] How to use file upload in agile toolkit 4.2

查看:68
本文介绍了如何在敏捷工具包4.2中使用文件上传的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在某处有一个完整的atk4.2文件存储示例代码示例吗?

Is there somewhere a full example of working atk4.2 filestore example code?

我一直在搜索文档和stackoverflow,而我发现的几个示例对我却没有用.

I've been searching in docs and stackoverflow and the few examples I have found just aren't working for me.

我是否需要扩展Model_FileModel_Filestore_File?

首先给我错误

未在文件中定义类

Class is not defined in file

第二个给出

无法包含filestore/lib/Model/Filestore/File.php

Unable to include filestore/lib/Model/Filestore/File.php

将文件上传添加到CRUD的最简单方法是什么?

What would be the simplest way to add file upload to CRUD?

推荐答案

如果要上传文件,请在模型中使用以下内容:

If you want to have file upload, use the following in your model:

$this->add('filestore/Field_File','file_id');

该字段应引用filestore_file.id.如果您要上传带有缩略图的图片,则:

the field should reference filestore_file.id. If you are looking to have a image upload with thumbnail, then:

$this->add('filestore/Field_Image','picture_id');

一旦上传了图片并提交了表单,文件的"id"将位于相应的字段中.对于Field_Image,它还将调整缩略图的大小.您可以使用自己的图片模型进一步自定义此图片:

Once image is uploaded and form is submitted, the "id" of the file will be in respective field. For Field_Image it will also resize the thumbnail. You can further customize this by using your own image model:

    ->setModel('MyImage');

class Model_MyImage extends filestore\Model_Image {
    public $default_thumb_width=32;
    public $default_thumb_height=32;
}

这在4.2.0上应该可以正常工作,但是开发"分支当前进行了一些改进,可以使每个图像具有多个缩略图大小.

This should work fine with 4.2.0, but the "development" branch is currently having some refinements which would allow to have multiple thumbnail sizes per image.

这篇关于如何在敏捷工具包4.2中使用文件上传的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆