Saving a pdf with fpdi


#1

I am using fpdi to create a pdf. I want to save to a folder in the public directory so I can get it later to email. This is how i’m trying to save it to a directory $filename = LOCAL_PATH_ROOT. "/worksheets/Payroll_Worksheet_" . $_SESSION['dept_num'] . '_' . $today . '.pdf'; When I try to run it I get this error FPDF error: Unable to create output file: /www/payroll/htdocs/payroll/public/worksheets/Payroll_Worksheet_46_01/16/18.pdf I thought it was permissions, but I have everything on 777 because i am programming on an as400 and that’s the easiest way to do things in developement. I tried the move_uploaded_file and move_to and can’t get anything to work. What am I doing wrong?


#2

Does this path even exists on your server?


#3

Yea. I have to create the directory and do a chmod on it before I upload. The directory can’t exist before I try to upload.


#4

the date in $today contains / , / is path directories separator.
You are trying to save “18.pdf” in “16” folder, in “Payroll_Worksheet_46_01” folder, in “worksheets” folder (etc.)

Usually folders aren’t created automatically, so you have an error because the path “/www/payroll/htdocs/payroll/public/worksheets/Payroll_Worksheet_46_01/16” does not exists.