简体   繁体   English

如何使用simple_form浏览文件夹?

[英]How do I browse folder using simple_form?

I want to add a file/folder browsing button in my rails application using simple_form gem. 我想使用simple_form gem在我的Rails应用程序中添加一个文件/文件夹浏览按钮。 How do I do it? 我该怎么做? In simple_form documentation it is not mentioned. 在simple_form文档中未提及。

Edit: File browse is mentioned in the documentation. 编辑:文档中提到了文件浏览。 But how to browse folders is not mentioned. 但是没有提到如何浏览文件夹。 Currently the only way I think possible is extract the folder from the file path. 目前,我认为可能的唯一方法是从文件路径中提取文件夹。 But what if there are no files present in the folder? 但是,如果文件夹中没有文件怎么办?

您可以这样做:

f.input :somename, as: :file

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

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