I am having a strange issue, I will try to keep it short, but it's a bit confusing so please excuse... I have the same MakeDir
command running for several pages, literally exact same code, but for some reason on one certain page the code does not work...
So a simple break down, I use the below code to create a directory if it does not already exist, and then I use mpdf to create a pdf in that directory. But for some reason I am unable to create the directory using the dynamic variables...
My code:
$directory = ROOT.'/companies/'.$current_document->company_id.'/employees/employee_'.$current_document->employee_id.'/documents/generated/signatures/'.str_replace('.pdf', '', $current_document->file_name).'/';
/* Create Directories */
if (!file_exists($directory)) {
mkdir($directory, 0777, true);
}
The above code gives me an error Warning: file_exists() expects parameter 1 to be a valid path, string given
and Warning: mkdir() expects parameter 1 to be a valid path, string given
But the value I get when I var_dump
the variable is /home/xxxxxxx/public_html/account/companies/2/employees/employee_1233/documents/generated/signatures/LWJiVq9/
and I should mention, that using makedir with the full path instead of the variable works perfectly for some reason...
Along with that the code generates the PDF using mpdf and puts it @ /home/xxxxxxx/public_html/account/companies/2/employees/employee_1233/documents/generated/LWJiVq9.pdf
in this case, but it also gets an error when generating mPDF error: Unable to create output file: /home/xxxxxxx/public_html/account/companies/2/employees/employee_1233/documents/generated/LWJiVq9.pdf
I am not sure what is causing it, because the same script generates all the other documents properly, only in this case does it completely bomb out each time...
Any Advise would be great :), Thanks guys.