简体   繁体   English

Silverstripe:前端用户上传目录

[英]Silverstripe: Front-end User Upload Directory

I'm trying to create a module that allows users to upload files from the front end. 我正在尝试创建一个模块,允许用户从前端上传文件。 I've seen this asked before but not specifically what I'm trying to achieve. 我之前已经看过这个问题了,但并没有明确我想要达到的目标。

Basically, I have a 'user dashboard' on the front end. 基本上,我在前端有一个“用户仪表板”。

On that dashboard I'd like a "My files" area that the user can see a list of all the files they've uploaded. 在该仪表板上,我想要一个“我的文件”区域,用户可以看到他们上传的所有文件的列表。

I'm thinking of adding an "Upload file" button which allows the user to obviously upload their file... 我正在考虑添加一个“上传文件”按钮,该按钮允许用户明显地上传他们的文件...

This file then gets saved in to the back end of silverstripe in a separate folder (I would imagine, separated by User ID/Name). 然后将此文件保存到silverstripe的后端,在单独的文件夹中(我想,用用户ID /名称分隔)。

I'm not really sure where to start as I'm quite new to back-end development. 我不太确定从哪里开始,因为我是后端开发的新手。 How would I go about creating this functionality? 我将如何创建此功能? Would I create a module that somehow extends the upload/files section of the CMS. 我是否将创建一个以某种方式扩展CMS上载/文件部分的模块。 Can someone point me in the right direction? 有人可以指出我正确的方向吗?

Just take a look at the UploadField documentation. 只需查看UploadField文档。 You probably want to use setCanPreviewFolder , setCanAttachExisting and setAllowedExtension . 您可能要使用setCanPreviewFoldersetCanAttachExistingsetAllowedExtension Maybe you should also take a look at securing your assets . 也许您也应该看看如何保护自己的资产 When you get in trouble coding all this, create a new question with as much info as possible and you will probably get a better answer. 当您在编写所有代码时遇到麻烦时,请使用尽可能多的信息创建一个新问题,您可能会得到更好的答案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM