kevmccor wrote on Sunday, September 15, 2013:
Warning: scandir(C:WindowsTEMP/edihist) [function.scandir]: failed
The “C:WindowsTEMP/edihist” path is wrong. The temporary directory is derived from the following function (line 249 csv_record_include.php):
function csv_edih_tmpdir() {
//define("IBR_UPLOAD_DIR", "/tmp/edihist");
$systmp = sys_get_temp_dir();
$systmp = stripcslashes($systmp);
return $systmp."/edihist";
}
So, the php call sys_get_temp_dir(); must be returning "C:WindowsTEMP". I would have expected "C:\Windows\Temp". Basically the file handling sequence is to copy uploaded files into the temporary directory, scan and categorize the files, save accepted files, do reading and extracting, and produce output. Then the temporary directory is cleared. If the temporary directory path is wrong it just won’t work.
You could try to change the line (252, 253):
// $systmp = stripcslashes($systmp);
return $systmp."/edihist"; to be: return $systmp."edihist";
(take out the slash) and see what happens. Also, try commenting out the stripcslashes().
Another possibility is to completely change the csv_edih_tmpdir() function to create a surrogate temporary directory under the edi history path:
function csv_edih_tmpdir() {
$systmp = csv_edih_basedir(); //$GLOBALS['OE_SITE_DIR'].'/edi/history';
if ($systmp) {
return $systmp.DIRECTORY_SEPARATOR."edihist";
} else {
return FALSE;
}
}
I do not think there are any hardcoded references to the temporary directory in the scripts, so every time the temporary directory is accessed it should be through the csv_edih_tmpdir() function. However, please use a test setup if you do this because the csv_clear_tmpdir() function deletes all the uploaded files from the temporary directory.
Issues with directory paths will happen with different operating systems, virtual computers, and environment variables. The PHP manual online says that sys_get_temp_dir(); gives inconsistent results, but I was not able to test on different systems. Since the edi history project is really all about uploaded files it is somewhat unique and the file handling was a big part of the project. The directory paths functions need people to try it on different systems and report issues. I appreciate your comment.
Kevin