Suggestion when csv upload fails
-
Hi, thank you for great plugin. It saved my time.
When using the plugin at first, I had failed uploading but there were no detailed error message shown. I modified the code to display the reason of failure, then I could take work-around (split csv files into smaller, to avoid upload_max_filesize limit).
So, I want to share my patch. Hope if the author also finds and takes it in.
csv_importer.php line 182
if (empty($_FILES['csv_import']['tmp_name'])) { // these messages are from PHP manual's comment static $file_upload_error_messages = array( 1=>'The uploaded file exceeds the upload_max_filesize directive in php.ini.', 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.', 'The uploaded file was only partially uploaded.', 'No file was uploaded.', 6=>'Missing a temporary folder.', 'Failed to write file to disk.', 'A PHP extension stopped the file upload.' ); $this->log['error'][] = 'No file uploaded, aborting. [' . $file_upload_error_messages[$_FILES['csv_import']['error']] . ']'; $this->print_messages(); return; }
- The topic ‘Suggestion when csv upload fails’ is closed to new replies.