Hi there,
I am not sure if anyone can help me. When trying to do a .csv file upload via Dataflow Profiles I keep getting this message when trying to upload the file. Screenshot is also attached below.
Upload File > Save Profile > Error message:
I have spoken to our developer and they cannot understand the problem. To be clear, there is NO problem with the file itself. If our developer uploads the file from their end it works fine and the products can be run successfully in the upload. We have done hundreds of uploads in the past without problem and old successful files still get the same error message. It only happens on my end, as I say this problem does not happen on our developers end. It also only happened after the latest upgrade of Mag to ver. 1.9.4.3.
I am not sure if anyone has any idea what may be causing this?
Thanks,
Dan
Solved! Go to Solution.
Good morning @dantemplar . We recently ran into this same issue with one of our clients after the upgrade to 1.9.4.3. The bug is in the file app\code\core\Mage\Dataflow\Model\Profile.php between line 154 and 182.
Here is a link to a screen shot of the before and after where we fixed the issue.
Of course, you do not want to modify your core files in Magento. So, you would create a copy of the file:
and place it in
Old Code:
$newUploadedFilenames = array(); if (isset($_FILES['file_1']['tmp_name']) || isset($_FILES['file_2']['tmp_name']) || isset($_FILES['file_3']['tmp_name'])) { for ($index = 0; $index < 3; $index++) { if ($file = $_FILES['file_' . ($index+1)]['tmp_name']) { $uploader = new Mage_Core_Model_File_Uploader('file_' . ($index + 1)); $uploader->setAllowedExtensions(array('csv','xml')); $path = Mage::app()->getConfig()->getTempVarDir() . '/import/'; $uploader->save($path); $uploadFile = $uploader->getUploadedFileName(); if ($_FILES['file_' . ($index + 1)]['type'] == "text/csv") { $fileData = $csvParser->getData($path . $uploadFile); $fileData = array_shift($fileData); } else {
New Code:
$newUploadedFilenames = array(); $mimes = array('application/vnd.ms-excel','application/octet-stream','text/plain','text/csv','text/tsv'); if (isset($_FILES['file_1']['tmp_name']) || isset($_FILES['file_2']['tmp_name']) || isset($_FILES['file_3']['tmp_name'])) { for ($index = 0; $index < 3; $index++) { if ($file = $_FILES['file_' . ($index+1)]['tmp_name']) { $uploader = new Mage_Core_Model_File_Uploader('file_' . ($index + 1)); $uploader->setAllowedExtensions(array('csv','xml')); $path = Mage::app()->getConfig()->getTempVarDir() . '/import/'; $uploader->save($path); $uploadFile = $uploader->getUploadedFileName(); if (in_array($_FILES['file_' . ($index + 1)]['type'] ,$mimes)) { $fileData = $csvParser->getData($path . $uploadFile); $fileData = array_shift($fileData); } else {
I hope that helps!
Good morning @dantemplar . We recently ran into this same issue with one of our clients after the upgrade to 1.9.4.3. The bug is in the file app\code\core\Mage\Dataflow\Model\Profile.php between line 154 and 182.
Here is a link to a screen shot of the before and after where we fixed the issue.
Of course, you do not want to modify your core files in Magento. So, you would create a copy of the file:
and place it in
Old Code:
$newUploadedFilenames = array(); if (isset($_FILES['file_1']['tmp_name']) || isset($_FILES['file_2']['tmp_name']) || isset($_FILES['file_3']['tmp_name'])) { for ($index = 0; $index < 3; $index++) { if ($file = $_FILES['file_' . ($index+1)]['tmp_name']) { $uploader = new Mage_Core_Model_File_Uploader('file_' . ($index + 1)); $uploader->setAllowedExtensions(array('csv','xml')); $path = Mage::app()->getConfig()->getTempVarDir() . '/import/'; $uploader->save($path); $uploadFile = $uploader->getUploadedFileName(); if ($_FILES['file_' . ($index + 1)]['type'] == "text/csv") { $fileData = $csvParser->getData($path . $uploadFile); $fileData = array_shift($fileData); } else {
New Code:
$newUploadedFilenames = array(); $mimes = array('application/vnd.ms-excel','application/octet-stream','text/plain','text/csv','text/tsv'); if (isset($_FILES['file_1']['tmp_name']) || isset($_FILES['file_2']['tmp_name']) || isset($_FILES['file_3']['tmp_name'])) { for ($index = 0; $index < 3; $index++) { if ($file = $_FILES['file_' . ($index+1)]['tmp_name']) { $uploader = new Mage_Core_Model_File_Uploader('file_' . ($index + 1)); $uploader->setAllowedExtensions(array('csv','xml')); $path = Mage::app()->getConfig()->getTempVarDir() . '/import/'; $uploader->save($path); $uploadFile = $uploader->getUploadedFileName(); if (in_array($_FILES['file_' . ($index + 1)]['type'] ,$mimes)) { $fileData = $csvParser->getData($path . $uploadFile); $fileData = array_shift($fileData); } else {
I hope that helps!
Thank you very much for that! It has solved the problem, all is working fine now!
Thanks again,
Dan
Thanks for sharing it. Its working fab.
I had the same problem and did the procedure, but now the error is another "Upload failed. Can not find required columns: sku in file export_all_products.csv", I tried to save just one product to test, I saved it as UTF-8, but the error persists, could you help?
@claudioca1985 have you found the solution to your error? I'm experiencing the same issue you described. I'd be glad if you can share how you solved the issue. Thanks
@claudioca1985 wrote:I had the same problem and did the procedure, but now the error is another "Upload failed. Can not find required columns: sku in file export_all_products.csv", I tried to save just one product to test, I saved it as UTF-8, but the error persists, could you help?
This issue was fixed in the SUPEE-11314 patch.
Diff file