Note that there are some explanatory texts on larger screens.

plurals
  1. POcakeDC utils csvImport use?
    primarykey
    data
    text
    <p>I am looking to use the cakeDC CSVimport behaviour. However, I cannot work out how to set it up and there doesn't seem to be any documentation or instructions around. I am uploading a csv then I need to insert the data into the a MySQL table. I have the upload working as required.</p> <p>NOTE: the csvimport behaviour is part of the cakeDC utils plugin: <a href="https://github.com/CakeDC/utils" rel="nofollow noreferrer">https://github.com/CakeDC/utils</a></p> <p>I have this in my upload model</p> <pre><code>var $actsAs = array('Utils.CsvImport'); </code></pre> <p>Within my upload controller I have this (after the file is uploaded successfully)</p> <pre><code>$this-&gt;Upload-&gt;importCSV('/maslayout/files/'. $thefilename); </code></pre> <p>I am then getting this error:</p> <pre><code>Fatal error: Uncaught exception 'RuntimeException' with message 'SplFileObject::__construct(/maslayout/files/customers_aussievets_24092010.csv) [&lt;a href='http://php.net/splfileobject.--construct'&gt;splfileobject.--construct&lt;/a&gt;]: failed to open stream: No such file or directory' in E:\xampp\htdocs\maslayout\app\plugins\utils\models\behaviors\csv_import.php:105 Stack trace: #0 E:\xampp\htdocs\maslayout\app\plugins\utils\models\behaviors\csv_import.php(105): SplFileObject-&gt;__construct('/maslayout/file...', 'rb') #1 E:\xampp\htdocs\maslayout\cake\libs\model\model_behavior.php(169): CsvImportBehavior-&gt;importCSV(Object(Upload), '/maslayout/file...') #2 E:\xampp\htdocs\maslayout\cake\libs\model\model_behavior.php(467): ModelBehavior-&gt;dispatchMethod(Object(Upload), 'importCSV', Array) #3 E:\xampp\htdocs\maslayout\cake\libs\model\model.php(496): BehaviorCollection-&gt;dispatchMethod(Object(Upload), 'importCSV', Array) #4 E:\xampp\htdocs\maslayout\cake\libs\overloadable_php5.php(50): Model-&gt;call__('importCSV', Array) #5 E:\xampp\htdocs in E:\xampp\htdocs\maslayout\app\plugins\utils\models\behaviors\csv_import.php on line 105 </code></pre> <p>Can you explain what I'm doing wrong?</p> <p>===========================================================================</p> <p>UPDATE: I worked out I simply had the path incorrect, now that I have this right it seems to be uploading however I don't really understand what to do next. I am not sure if I need to set the CSV document up somehow and how do I get the model set so the import will work and match up. Any help would be appreciated. I have it on my uploads model and this is basically insert empty rows into the uploads table. Even when I have the right headers on the form this still happens.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload