File-Upload Plugin Not Working With Existing Table

nobicycle

New Member
To prove this:

  1. Create a List. Add an fileupload element. Set Ajax Uploads=yes
  2. Open the corresponding form and add a record. All will work fine.
  3. Look in the database and extract the DDL of the table Fabrik created in step 1.
Example​
CREATE TABLE `testajax` (​
`id` int(11) NOT NULL AUTO_INCREMENT,​
`date_time` datetime DEFAULT NULL,​
`file_id` text,​
PRIMARY KEY (`id`)​
)​
4.Change the table name, postfix a 2 for example and run it in your joomla schema.
5. Redo steps 1. and 2. but use the pre-existing table, in this case testajax2 Go into the fileupload element (here file_id) and set the plugin to be fileupload with Ajax Uploads=yes. You will find the form only displays the label for file_id and has a button CLOSE on the right hand side.

I am using Github version (but not updated for about 2 weeks).
 

Attachments

  • Screenshot_2015-04-24_00-52-21.png
    Screenshot_2015-04-24_00-52-21.png
    22.1 KB · Views: 215
Not clear what do you expect to achieve.
If you set fileupload to AJAX upload mode then a new DB table is created for this element and its uploads.
In your case its name should be testajax_repeat_file_id, it has fields id (PK), parent_id (FK, for values from testajax.id), file_id (for file values) and params (don't ask)
So I suspect that the "close" button means that your element is set to be AJAX upload but in some reasons doesn't have any corresponding tablename_repeat_elementname table behind.
 
Not clear what do you expect to achieve.
If you set fileupload to AJAX upload mode then a new DB table is created for this element and its uploads.
In your case its name should be testajax_repeat_file_id, it has fields id (PK), parent_id (FK, for values from testajax.id), file_id (for file values) and params (don't ask)
So I suspect that the "close" button means that your element is set to be AJAX upload but in some reasons doesn't have any corresponding tablename_repeat_elementname table behind.

Hi Jaanus
I expect when an element corresponding to field in an existing table is set to fileupload plugin, then it will work as such.
Incidentally, if this is done, Fabrik ** does ** create the "repeat" table with the 4 fields you mentioned.
I just tested adding an element ** via fabrik ** to the form (and table, **via modification by Fabrik) to see if that worked. It only works if I unpublish the first fileupload field (existing table field).
if I publish the first fileupload field than the form behaves badly, as per the image I attached at the top of the thread.

It only takes one minute to test this. Point a new list at an existing table, then change a field to fileupload in the corresponding form.


Best wishes
 
Can you try changing it to fileupload (just simple upload, no AJAX), save the element, edit it again and change it to AJAX?

-- hugh
 
Can you try changing it to fileupload (just simple upload, no AJAX), save the element, edit it again and change it to AJAX?

-- hugh

Hello Hugh
So I changed the "existing table" field to no Ajax and also the "Fabrik table" field to no Ajax. The form worked fine in no-ajax mode.
Changing the "existing table" field to Ajax again caused the same problems with the form.
 
OK, just to be sure:
you have now 2 test tables - testajax and testajax2, right?

You first created a new db table testajax on the fly with new list "Fabrik table", added there a fileupload element and set it to AJAX mode - worked correctly (and new table for this element testajax_repeat_file_id was created).

Then you went to phpmyadmin, created another table testajax2 with similar fields (`id`, `date_time`, `file_id`), then came back to Joomla and Fabrik, created new list called "Existing table" on the newly created db table, changed an element on file_id to fileupload in AJAX upload mode - and this one doesn't work (and there is no table testajax2_repeat_file_id).
 
OK, just to be sure:
you have now 2 test tables - testajax and testajax2, right?

You first created a new db table testajax on the fly with new list "Fabrik table", added there a fileupload element and set it to AJAX mode - worked correctly (and new table for this element testajax_repeat_file_id was created).

Then you went to phpmyadmin, created another table testajax2 with similar fields (`id`, `date_time`, `file_id`), then came back to Joomla and Fabrik, created new list called "Existing table" on the newly created db table, changed an element on file_id to fileupload in AJAX upload mode - and this one doesn't work (and there is no table testajax2_repeat_file_id).

Correct, except that table testajax2_repeat_file_id table ** does get created by fabrik when the elemet is changed to fileupload.

I just did a complete reinstall of Joomla and Fabrik (Github version).
Same story.
Though I did notice one small difference.
When I clicked add record on testajax it worked fine in so far as the ajax control was there. I didn't bother to add a record.

When I clicked add record on testajax2, it complained as follows:
"JFolder: :folder: Path is not a folder. Path: /srv/http/joomla/images/stories/"
But creating that folder, with correct privileges, made no difference - the same error appeared as in the image I posted.
 
Replicated. It's a bug.
It occurs after you change the pre-existing element's type (e.g. field) to fileupload with AJAX upload mode. (new db table for this element, however, is created). To make it work as expected you should change the element again to something else than fileupload (say 'field'), then back to fileupload and AJAX yes.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top