Drupal6:我需要在节点编辑表单中自定义文件上传链接
我正在使用 form_alter 自定义内容类型的节点/添加和节点/编辑表单。在我的内容类型中,有一个文件字段允许将文件上传到内容。
我想做的是通过更改在运行时使用 Ajax 编写的文件的链接来自定义文件框。如何在不修改Drupal核心的情况下做到这一点?
I am customizing the node/add and node/edit forms of a content type with a form_alter. In my content type, there is a file field that permits to upload files to the content.
What I would like to do is to customize the file box by changing the link to the file that is composed at runtime with Ajax. How can I do it without modifying Drupal core?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的私人文件目录不应位于文档根目录中。正如您在评论中指出的那样,使用 .htaccess 规则隐藏它是行不通的。
假设您的 Drupal 位于
/var/www/sites/example.com/
中,那么您不应该将您的私人文件存储在该目录下;/var/www/sites/example.com/sites/default/private/files/
完全是错误的。您应该将文件存储在 apache 不会提供服务但可以读取它们的位置。例如在
/var/www/files/example.com/
中。然后更改 Drupal 中的设置以使用该绝对路径。如果您正在运行大型站点,您可能希望将文件存储在专用安装(驱动器、NFS 等)上,例如
/media/nfs-example-com/
。Your Private Files directory should not be in the docroot. Hiding it with a .htaccess rule will not work, as you point out in a comment.
Say you have Drupal in
/var/www/sites/example.com/
, then you should not store your private files under that directory;/var/www/sites/example.com/sites/default/private/files/
is just plain wrong.You should, instead store the files where apache will not serve them, but can read them. E.g. in
/var/www/files/example.com/
. Then change the setting in Drupal to use that absolute path.If you are running a large(r) site, you will probably want to store your files on a dedicated mount (drive, NFS etc.), say
/media/nfs-example-com/
.尝试文件字段路径:
http://drupal.org/project/filefield_paths
Try Filefield Paths:
http://drupal.org/project/filefield_paths