Upload files on item detail page for module

alt=
@dobmat
10 years ago
93 posts
I want files upload feature on item detail page for a module item for e.g. by means of say a button. The uploaded files must then appear on item detail page. Please give suggestions.

Thanks.
updated by @dobmat: 06/11/14 12:04:33AM
paul
@paul
10 years ago
4,326 posts
Can you explain a bit more?
What do you want to achieve?
Are the uploads for the profile owner or for anyone to upload?
etc. etc.


--
Paul Asher - JR Developer and System Import Specialist
alt=
@dobmat
10 years ago
93 posts
I want the user that has created the item to be able to upload files under a module. For e.g. if you take jrBlog, if the user clicks on item of the blog he will see its details. What I want is the blog item should have a way to associate files with it. It is not modifying the blog. Then those files should be displayed in blog item detail page.

Thanks.
michael
@michael
10 years ago
7,715 posts
You want the Form Designer. You can add a 'File' type to the form.

"Form Designer"
https://www.jamroom.net/the-jamroom-network/documentation/getting-started/1275/using-the-form-designer
alt=
@dobmat
10 years ago
93 posts
Can I use it on custom modules?

Thanks.
alt=
@dobmat
10 years ago
93 posts
I do not want to create a form. On the item detail page itself I want the functionality of uploading files. I'm guessing I will have to modify the item_detail.tpl or is there anything available for that within basic modules.

Thanks.
updated by @dobmat: 04/16/14 06:35:18AM
brian
@brian
10 years ago
10,148 posts
dobmat:
I do not want to create a form. On the item detail page itself I want the functionality of uploading files.

You will need to do something custom for this - this is not something Jamroom supports (all file uploads needs to be part of a form view).

Sorry!


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
alt=
@dobmat
10 years ago
93 posts
brian:
You will need to do something custom for this - this is not something Jamroom supports (all file uploads needs to be part of a form view).

Sorry!
Hi Brian

Can you give some hints on it like which code I can use as example.

Thanks.
updated by @dobmat: 04/17/14 03:52:19AM
brian
@brian
10 years ago
10,148 posts
dobmat:
Hi Brian

Can you give some hints on it like which code I can use as example.

Thanks.

Unfortunately there really is no code to use as an example, since what you are trying to do is add an upload progress system and form to a template page - it's quite complicated (which is why we don't put it in a template).

You'll want to go to a form that allows uploads (say modify profile) and see how the Javascript for the upload progress meter and form field work together, and then duplicate that in your template.

Hope this helps!


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
alt=
@dobmat
10 years ago
93 posts
Thanks for the info. Is it possible to have a multiple files to a single field in the form. Say I have a venue_files field, is it possible to store multiple files of this type in datastore.

Thanks.
brian
@brian
10 years ago
10,148 posts
dobmat:
Thanks for the info. Is it possible to have a multiple files to a single field in the form. Say I have a venue_files field, is it possible to store multiple files of this type in datastore.

Thanks.

Yes - check out the gallery module as an example of allowing multiple file uploads from a single form button.

Hope this helps!


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
alt=
@dobmat
10 years ago
93 posts
brian:
dobmat:
Thanks for the info. Is it possible to have a multiple files to a single field in the form. Say I have a venue_files field, is it possible to store multiple files of this type in datastore.

Thanks.

Yes - check out the gallery module as an example of allowing multiple file uploads from a single form button.

Hope this helps!

Thanks for the info. Is there any buttons that I can add to item detail page. Right now I have the update and delete buttons for which I have funtions defined in the index.php file. Is there a way I can add upload button and then define a function for upload in index.php.

Thanks.
updated by @dobmat: 04/29/14 06:51:15AM
brian
@brian
10 years ago
10,148 posts
dobmat:
Thanks for the info. Is there any buttons that I can add to item detail page. Right now I have the update and delete buttons for which I have funtions defined in the index.php file. Is there a way I can add upload button and then define a function for upload in index.php.

You would have to do something custom for this - there is no "upload button" support that you can add directly to an item detail page.

Sorry!


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
alt=
@dobmat
10 years ago
93 posts
Do you mean adding a function in core module or can I do it in my custom module?

Thanks.
brian
@brian
10 years ago
10,148 posts
dobmat:
Do you mean adding a function in core module or can I do it in my custom module?

Thanks.

You would always do it in your own module - not in the core.

Hope this helps!


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
michael
@michael
10 years ago
7,715 posts
dobmat:
Right now I have the update and delete buttons for which I have funtions defined in the index.php file.

Delete does not require any extra input, just the item id. but update requires a page redirect to a form.

You can put that extra upload into the update form via the Form Designer.

--edit--
This might be a good course for you:
https://www.udemy.com/developers-guide-to-customizing-jamroom/

Its free for all backstage members here:
"100% Off Coupon for Developers Guide to Customizing Jamroom Udemy Course"
https://www.jamroom.net/backstage/forum/resources/3112/100-off-coupon-for-developers-guide-to-customizing-jamroom-udemycom-course
updated by @michael: 04/29/14 06:40:52PM
alt=
@dobmat
10 years ago
93 posts
brian:
dobmat:
Do you mean adding a function in core module or can I do it in my custom module?

Thanks.

You would always do it in your own module - not in the core.

Hope this helps!

Can you please give a bit more detail on how I go about with it. As far as I have investigated the buttons function is defined in the jrCore/lib/smarty.php. Where do I write the function to have my custom buttons and how Jamroom core is going to pick that function up.

Thanks.
alt=
@dobmat
10 years ago
93 posts

That worked for me. Also for using gallery module that was suggested earlier for multiple file upload, will it work if I try the form creation from that module to my module. Is it possible that I create a form from an upload button in item detail page and upload multiple files. Then when it redirects back to the item detail page, will I have all the files uploaded to display on that page.

Thanks.
michael
@michael
10 years ago
7,715 posts
dobmat:... Is it possible that I create a form from an upload button in item detail page and upload multiple files. Then when it redirects back to the item detail page, will I have all the files uploaded to display on that page.

Sorry I don't understand what you are asking.
alt=
@dobmat
10 years ago
93 posts
michael:
Sorry I don't understand what you are asking.
I have an upload form in the index.php of my module. I've put a button in item detail page to redirect to the upload form. Now is it possible to use the image gallery module as an example and use its code to upload multiple files using the form I mentioned. I'm asking this because item-detail.tpl does not get _items array. So if I can upload multiple files I'm not sure how I can retrieve the uploaded files to display on item detail page.

Thanks.
michael
@michael
10 years ago
7,715 posts
Sounds like the question your asking is the normal way to do it.

click button --- go to form -- upload files --- display files on item_details.tpl page.

-- edit --
use the {debug} function in the templates to see what vars are available to you

"{debug}"
https://www.jamroom.net/the-jamroom-network/documentation/development/1477/debug
updated by @michael: 05/02/14 08:57:50PM
alt=
@dobmat
10 years ago
93 posts
I have the jrGallery module now, but the module tab doesn't show up on the profile page. I have enabled the module in the ACP.

Thanks.
SteveX
SteveX
@ultrajam
10 years ago
2,584 posts
Is the module allowed for the proifile quota?


--
¯\_(ツ)_/¯ Education, learning resources, TEL, AR/VR/MR, CC licensed content, panoramas, interactive narrative, sectional modules (like jrDocs), lunch at Uni of Bristol. Get in touch if you share my current interests or can suggest better :)
alt=
@dobmat
10 years ago
93 posts
I got it working now. In the upload function I mentioned above, what I want is when I upload new docs the old ones should not be replaced. Instead it should add to existing entries in the datastore. I'm using the following code in my upload function in index.php,

$_rt = jrCore_db_get_item('gsVenue', $_post['id']);
$_sv = jrCore_form_get_save_data('gsVenue', 'upload', $_post);
$_new = array_merge($_rt, $_sv);
jrCore_db_update_item('gsVenue', $_post['id'], $_new);

But, it seems the newly uploaded files are not there. I'm getting error "you forgot to select a file to upload".

Thanks.
SteveX
SteveX
@ultrajam
10 years ago
2,584 posts
Do you need to use jrCore_save_all_media_files?

Your save function should be similar to jrFile update save.


--
¯\_(ツ)_/¯ Education, learning resources, TEL, AR/VR/MR, CC licensed content, panoramas, interactive narrative, sectional modules (like jrDocs), lunch at Uni of Bristol. Get in touch if you share my current interests or can suggest better :)
alt=
@dobmat
10 years ago
93 posts
Yeah, I have a call to jrCore_save_all_media_files function. Does this function jrCore_db_update_item checks to see if for an item id all the values previously existing is modified. This is because most of the content is same except for the new uploaded files.

Thanks.
updated by @dobmat: 05/08/14 06:57:32AM
michael
@michael
10 years ago
7,715 posts
dobmat:...it seems the newly uploaded files are not there. I'm getting error "you forgot to select a file to upload".

That error is usually associated with the _file field being 'required' on update.
alt=
@dobmat
10 years ago
93 posts
I went through the gallery module, and I see it is creating different item id for every image that I upload. From my previous functionality I can upload multiple files but what it is doing is if my field is venue_files, it is creating entries as venue_file_name, venue_files_2_name, venue_files_3_name etc. But every time I update the field it starts from venue_file_name and all the previously uploaded files are not available on post. Is there any way I can have all the files under single item id and still add more entries on update.

Thanks.
updated by @dobmat: 05/09/14 07:14:27AM

Tags