I am building an extension with extbase where I need to create a pdf file inside fileadmin folder with php from a controller :
fopen("/fileadmin/pdf/anass.pdf", "w") or die('could not create file');
The permission is granted to write files ... so I think I made a mistake writing the path. Could somebody please help me?
PS: I am working on typo3 4.5
Best How To :
Indeed you're specifying absolute path in the filesystem and most probably there's no such path like
Quite safe would be using some TYPO3 constant to specify where's your app's root i.e.
fopen(PATH_site . "/fileadmin/pdf/anass.pdf", "w") or die('could not create file');
it will use the path like (sample)
note, that if you should use slash before
fileadmin or not is OS/server config depended, so just check if your
PATH_site ends with slash or not.