Drupal 7菜鸟问题:允许用户访问表单和用户上传文件
我可能会在这篇文章的序言中说,我对 Drupal 7 非常陌生,到目前为止刚刚阅读了《Drupal 7 模块开发》一书和一些在线教程。
我正在尝试制作一个允许用户上传和查看数据集合的网页。这些集合将包含屏幕截图、集合描述以及 XML 文件集合。我希望用户能够通过表单上传 .zip 文件,然后将该 zip 分开并添加到主页,该主页将显示所有集合及其屏幕截图和描述。
到目前为止,我发现了一些教程可以帮助我进行基本的文件上传,但这从来都不是我想要的。在我根据教程创建的示例中,我创建了一个新的内容类型和一个表单,现在我可以单击添加内容,这将打开我的表单,该表单允许我上传与我的内容类型关联的图像文件。我永远无法弄清楚的是,如何让这样的表单显示在用户可以访问的页面上(而不是在选择似乎只能由管理员使用的添加内容后弹出)。我希望有一个页面显示我的画廊,并带有一个按钮,该按钮会将用户带到可用于上传内容的表单。
任何人都可以解释我将如何做到这一点,或者向我指出一些我可能错过的更好的教程/示例。另外,是否有任何好的模块可以作为此类工作的良好起点?
I would likely to preface this post by saying that I am extremely new to Drupal 7 and so far have just gone through the book Drupal 7 Module Development and a few online tutorials.
I am trying to make a webpage that allows user to upload and view collections of data. These collections will consist of a screenshot, a description of their collection and a collection of XML files. I would like the user to be able to upload a .zip file through a form and then have that zip get seperated and added to the main page which will show all of the collections with their screenshots and descriptions.
So far I have found a couple tutorial that helped me get a basic file upload going but it was never quite what I wanted. In the example I created from the tutorial I created a new content type and a form and I can now click on add content which will bring up my form that allows me to upload an image file which will be associated with my content type. What I could never quite figure out was how I would get a form like this to show up on a page that the user can access (instead of popping up after selecting add content which seems to be only usable by administrators). I would like to have a page that shows my gallery with a button that would take the user to a form they could use to upload their content.
Can anyone explain how I would do this or maybe point me at some better tutorials/example that I may have missed. Also, are there any good modules that might be a good starting point for this type of endeavor?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
可能我完全不知道你想做什么...但是上传 XML 文件、设置描述和上传图像,全部作为内容类型,比上传 .ZIP 文件拆分要容易得多将其保存在服务器中并保存。
然后,要允许用户上传文件,您必须配置权限和角色。您希望匿名用户上传文件吗?如果没有,您必须设置角色和注册首选项。
在我看来,你不需要编码就可以做你想做的事。
我建议您通过以下链接开始学习 Drupal:
http://gotdrupal.com/
http://learnbythedrop.com/
希望有帮助!
Probably I don't know what you are trying to do entirely... but uploading the XML file, setting the description and uploading the Image, separately, all as a content type, is far easy to implement than uploading a .ZIP file split it in server and save it.
Then, to allow users to upload files you must config the permissions and roles. Do you want anonymous users to upload files? If not, you must set roles and registration preferences.
It seems to me that you can do what you want without coding.
I suggest you these links to start learning with Drupal:
http://gotdrupal.com/
http://learnbythedrop.com/
Hope that helps!
链接很简单,只需将 URL 路径复制到添加内容页面并将其用作链接 - 确保您的用户在权限区域中拥有“创建 #content 类型”和“编辑自己的 #content 类型”的“权限”警告用户 - 如果您向匿名用户提供此信息,您将收到垃圾邮件,因此请确保您也安装了 mollom (nice) 或 kaptcha
,您可以添加链接 。一旦你拥有了 对于 zip 文件,
您可以定义内容类型的上传字段中允许哪些文件,并限制为 zip 并设置最大上传大小(强烈推荐!)。页面上的标题和链接等 - 这是您未来的学习项目:-)
Link is easy, just copy the URL path to the add content page and use it as a link - making sure that your users have 'permission' to 'create #content type' and 'edit own #content type" in the permissions area under users. A word of warning - if you offer this to anon users you will get spammed so make sure you have mollom (nice) or kaptcha installed as well.
Beto is right too, you can add the links once you have the url to navigation menus.
For zip file you can define what files are allowable in an upload field in your content type and restrict down to zips and set a maxiumum upload size (highly recommended!). Later on you can use views module to display lists of titles and links etc on pages - that's your future learning project :-)