Warning: mkdir(): No such file or directory in C:\webdev\BalforNet2\resources\database.class.php on line 309
Warning: move_uploaded_file(C:/webdevBalforNet2/documents/training/Co_nove_prinasa_php4.pdf): failed to open stream: No such file or directory in C:\webdev\BalforNet2\resources\database.class.php on line 311
Warning: move_uploaded_file(): Unable to move 'C:\apache2triad\temp\php10E.tmp' to 'C:/webdevBalforNet2/documents/training/Co_nove_prinasa_php4.pdf' in C:\webdev\BalforNet2\resources\database.class.php on line 311
File NOT uploaded
this is the function from file database.class.php in which are the lines 309 and 311
Code: Select all
function uploadDocument($fileArray, $var_staff_id, $section, $label, $dbConn) {
$fileName = $fileArray['name'];
$fileNameNoExtension = substr($fileArray['name'], 0, -4);
$fileExt = substr($fileArray['name'], -4);
$fileSize = $fileArray['size'];
$fileType = $fileArray['type'];
$dir = $_SESSION['root']."/documents/". $section ."/";
$fullpath = "$dir";
if ( file_exists($fullpath.$fileName) ) {
echo "<p> Rename file please! This one already exists </p>";
return 0; }
else {
if (!is_dir($fullpath)) mkdir("$fullpath", 0777);
if (move_uploaded_file($fileArray['tmp_name'],$fullpath.$fileName)) {
$sql = "INSERT INTO documents (
`section` ,
`author_id`,
`label` ,
`filename` ,
`create_date` ,
`visibility`
)
VALUES (
'".$section."',
'".$_SESSION['staff_id']."',
'".$label."',
'".$fileNameNoExtension."',
'".date("Y-m-d")."',
'1'
)";
$dbConn->queryDB($sql);
return 1;
} else {
print('File NOT uploaded');
return 0;
}
}
// return '1';
}