1

Topic: Issues uploading media to the warehouse

Hi,

We have created a pre-built form that uses the data_entry_helper class to send a single sample-occurrence pair across to the test warehouse that we have set up.

In that pre-built form, we use the data_entry_helper::file_box method, with the default settings (have also tried to use data_entry_helper::image_upload with 'fieldname' => 'occurrence:image' for the image options). The media files are correctly appearing in the Uploads folder on our local website, as it should based on the data_entry_helper code.

In the get_submission form, we have

        $submission = data_entry_helper::build_sample_occurrence_submission($values);
        $response = data_entry_helper::forward_post_to('occurrence', $submission);
        return data_entry_helper::dump_errors($response);

as per the documentation. We have also tried with 'save' instead of 'occurrence'.

In general, we are able to record our occurrences correctly in the warehouse, but the media files won't transfer to the warehouse to be attached to the occurrence.

With the code as above, we get the following error message as well:
An error occurred when the data was submitted.

general_errors.Undefined index: id
Error occurred in D:\web sites\indicia-git\modules\indicia_svc_data\controllers\services\data.php at line 1290

Do you have any ideas regarding what the issue is and how we can solve it?

2

Re: Issues uploading media to the warehouse

Hi

In the call to forward_post_to(), the examples I see all use 'save' as the first parameter.
I can see the comment on the function says "Name of the top level entity being submitted, e.g. sample or occurrence." In your case I think 'sample' would be the top level. Do you get the same error of undefined index if you use 'save'?

Until the response to the posting of data is error free there is no sending of the images as you may be able to understand from the code in the forward_post_to() function.

Can you access the warehouse log http://testwarehouse.indicia.org.uk/ind … erver_logs

This may help with further debugging - for example I see this stack trace.

00:32:30 debugPgSQL Database Driver Initialized
00:32:30 debugDatabase Library initialized
00:32:30 debugGlobal GET, POST and COOKIE data sanitized
00:32:30 debugCache Library initialized
00:32:30 debugCache Library initialized
00:32:30 infoAuthentication successful.
00:32:30 infosubmit
00:32:30 error#8: Error converted to exception. Undefined index: id at line 1290 in file D:\web sites\indicia-git\modules\indicia_svc_data\controllers\services\data.php
00:32:30 debugStack trace:
D:\web sites\indicia-git\modules\indicia_svc_data\controllers\services\data.php - line 1290 - indicia_error_handler
D:\web sites\indicia-git\modules\indicia_svc_data\controllers\services\data.php - line 1281 - submit_single
D:\web sites\indicia-git\modules\indicia_svc_data\controllers\services\data.php - line 1252 - submit
Unknown file - line Unknown - save
D:\web sites\indicia-git\system\core\Kohana.php - line 291 - invokeArgs
Unknown file - line Unknown - instance
D:\web sites\indicia-git\system\core\Event.php - line 209 - call_user_func
D:\web sites\indicia-git\system\core\Bootstrap.php - line 55 - run
D:\web sites\indicia-git\index.php - line 112 - require

3

Re: Issues uploading media to the warehouse

Hi all,

The issue here was that we were not providing read authentication and the caption value to the data_entry_helper::file_box() method options parameter.

Once we provided the following:

              'table'=>'occurrence_image',
              'readAuth' => $auth['read'],
              'caption'=>lang::get('File upload')

The file upload started working and correctly attaching the files to the occurrence as we needed.