File not uploaded with transient field & relationship

Archived from the Xataface Users forum.

tomhousley — Wed Feb 10, 2010 8:18 am

Hello,

I have two tables:

tbl_quote
tbl_quote_images

the structure of each is:

Code: Select all
quo_id       int(6)                                         (NULL)           NO      PRI     (NULL)   auto_increment  select,insert,update          job_id       int(6)                                         (NULL)           YES             (NULL)                   select,insert,update          quo_type     enum('Quote','Estimate','Risk Bearing Quote')  utf8_general_ci  YES             (NULL)                   select,insert,update          quo_amount   decimal(10,2)                                  (NULL)           YES             (NULL)                   select,insert,update          usr_id       int(6)                                         (NULL)           YES             (NULL)                   select,insert,update          quo_deleted  tinyint(1)                                     (NULL)           YES             0                        select,insert,update          quo_date     datetime                                       (NULL)           YES             (NULL)                   select,insert,update

and

Code: Select all
qui_id              int(6)       (NULL)             NO      PRI     (NULL)   auto_increment  select,insert,update          quo_id              int(6)       (NULL)             NO              (NULL)                   select,insert,update          qui_image           longblob     (NULL)             YES             (NULL)                   select,insert,update          qui_image_mimetype  varchar(64)  latin1_swedish_ci  YES             (NULL)                   select,insert,update          qui_image_filename  varchar(64)  latin1_swedish_ci  YES             (NULL)                   select,insert,update

/tbl_quote/fields.ini looks like this:

Code: Select all
`sql = “select * from tbl_quote where quo_deleted <>1 order by quo_id DESC”

[quo_id]
widget:label=”Quote ID”

[job_id]
widget:label=”Job ID”
widget:type = select
vocabulary = job_id

[quo_type]
widget:label=”Quote Type”

[quo_amount]
widget:label=”Amount”

[qui_id]
widget:label=”Images Supplued By Client”
relationship=tbl_quote_images
transient=1
widget:type=grid
widget:columns=”qui_image,qui_image_filename”

[usr_id]
widget:label=”Entered By”

[quo_deleted]
widget:label=”Delete Quote”
widget:type = checkbox
visibility:list = hidden`

/tbl_quote/relationships.ini looks like this:

Code: Select all
[tbl_quote_images] __sql__ = "SELECT * FROM tbl_quote_images WHERE quo_id='$quo_id'" action:visible = 0

When I create a new record in tbl_quote and I choose multiple files (which are saved in tbl_quote_images) <150K each to upload and click on save, the images are not saved in the database, though the field qui_image shows just the filename.

Am I doing something incorrectly or is this a limitation of xataface?

Many thanks, Tom


shannah — Wed Feb 10, 2010 9:39 am

Currently the file widget doesn’t work inside the grid widget. I’m working on an ajax file upload widget that will be compatible with the grid widget but I don’t have an ETA on its completion (it’s currently in the pile of things to do).

You might be able to hack something together in the beforeSave() that will fetch the uploaded file and store it custom. E.g. use standard PHP file upload techniques… the file should show up in the $_FILES super global — but you would have to get your hands a little dirty.


tomhousley — Wed Feb 10, 2010 9:44 am

Hi Steve,

Thank you for the prompt reply. I think I will wait for the an ajax file upload widget.

Many thanks, Tom