简体   繁体   English

杂货杂货文件上传服务器上的字段选择文件

[英]grocery crud file upload field pick file from server

I'm developing a web site with codeigniter + grocery crud . 我正在用codeigniter + grocery crud开发一个网站。

I really like the upload file feature from grocery crud. 我真的很喜欢杂货杂货店的上传文件功能。

But I'm wondering if it's possible to pick a file from a server folder instead of uploading it. 但是我想知道是否有可能从服务器文件夹中选择一个文件而不是上传它。 I mean just put the name of the file in the field. 我的意思是将文件名放在字段中。

I don't want to write more than what is needed. 我不想写超出需要的内容。

Edit: I want the user to be able to do both: upload a file, or pick it from a server folder. 编辑:我希望用户能够做到这两者:上传文件,或从服务器文件夹中选择它。

I've been asking myself the same question. 我一直在问自己同样的问题。 I was thinking in doing it like this: 我在想这样做:
1 - Create a Media Library table (Wordpress style) and store all the file uploads in a table. 1-创建一个媒体库表(Wordpress样式),并将所有上传的文件存储在一个表中。
2 - Add a relation field to select images form this table. 2-添加一个关系字段以选择此表中的图像。 http://www.grocerycrud.com/examples/set_a_relation http://www.grocerycrud.com/examples/set_a_relation

The basic relation field will generate a select that allows you to select images by name, id, description, etc. 基本关系字段将生成一个选择,使您可以按名称,ID,描述等选择图像。
This is not very user friendly, so I guess you'll have to write one or two callback functions to show the users the image they are selecting 这不是非常用户友好,所以我想您必须编写一个或两个回调函数才能向用户显示他们选择的图像

this is the approach I'll be using on my next codeigniter+grocerycrud project :) 这是我将在下一个codeigniter + grocerycrud项目中使用的方法:)

Good luck! 祝好运!

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

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