質問

I need to do some customization to the CRUD. Basically i need to upload multiple files in an Add or Edit Action, and all i'm going to save in the database is the url of the folder that will contain the images.

I have been searching the forum, and it seems like I have to do this myself.

What i'm doing, is showing multiple upload buttons using the add_field_callback function, and so far so good.

The problem is that i also need some custom callback, to save the name and url of the uploaded files.

I've been reading the GroceryCRUD source code, and cant figure out how to use or create callbacks. I'm trying to use call_user_func for the callbacks, however, it doesn't work because each upload creates a new PHP request, and the variable that saves the user callback is empty in this context.

I was wondering if someone could explain me how do the GroceryCRUD callbacks work.

Thank you for your time.

役に立ちましたか?

解決

Actually the question of how the grocery CRUD callback works is at the documentation: Tutorial - Using Callbacks .

Now about your request for the multiple files upload is not possible to be done with a simple callback. This is a more complicated task and you need to change the groceryCRUD library in order to achieve this. The best way is to actually create a new "type" (for example "upload_file_multiple") and create a new functionality that grocery CRUD doesn't have. If you take the time and create this functionality it would be good if you share the code to the community as well.

At the meanwhile (as @BernalCarlos already answered) , there is a post at the forums that our friend Victor Halauko created . It is an extension in order to have the multiple uploads in grocery CRUD. You can find this topic here

他のヒント

For the multiupload part, i found this really useful post on the GroceryCRUD forum http://www.grocerycrud.com/forums/topic/1912-updated-30072013-multiple-uploading/

I think the solution suggested on this post this could be implemented in the core of the library as a new type (thanks to John Skoumbourdis).

I'll try to implement this on some spare time, and share it.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top