[TYPO3-mvc] Confusion with filesize() path

Sebastian Schreiber me at schreibersebastian.de
Wed Apr 11 15:32:50 CEST 2012


This question is not really related to extbase or fluid.

It is always good practice to make the path absolute in this case.
Call this in your viewhelper and you should be fine:

$absPathToFile = 
t3lib_div::getFileAbsFileName('uploads/tx_myext/pdf/XXX.pdf');
if(is_file($absPathToFile)) {
   return filesize($absPathToFile);
}
return NULL;

Should work in Backend and Frontend.



Am 11.04.2012 14:58, schrieb g4-lisz at tonarchiv.ch:
> Hi there,
>
> i'm using the PHP filesize function in a few places of my extension.
>
> For the views i wrote a view helper which works like expected i.e. 
> filesize() can handle the reltive file path:
>
>     filesize('uploads/tx_myext/pdf/XXX.pdf')
>
> If i'm using the same call directly from an action controller in the 
> backend, i always get the size=0.
>
> Why does the reltive path work in a view helper, but not in a action 
> controller? Is this because it's a controller for a backend template?
>
> Cheers,
> Till
> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc


-- 
Sebastian Schreiber
(Medieninformatiker B.Sc.)
(TYPO3 Certified Integrator)

Schanzenstraße 27, Schlosserei 4
D-51063 Köln

T  0221 677 88 541
M  0176 431 05 790

Skype schreibersebastian.de

me at schreibersebastian.de
www.schreibersebastian.de

Steuernummer: 217 / 5269 / 4675



More information about the TYPO3-project-typo3v4mvc mailing list