Skip to content
Advertisement

filesize(): stat failed for specific path – php

i am coding a simple doc managing script and need to get the file size and file type /file or folder/ in a table. somehow it doesn’t work into the mention directory. please help if possible:

JavaScript

it does actually has 2 errors – one the file size doesn’t work for the location, if i change it to path to “.” – everything is ok, but if i try to change to the folder where i need it /documents …all goes bad, and secondly – it doesn’t take the right icon file as well, same type of problem. thank you

Advertisement

Answer

Problem is, $file is only the filename without the directory prefix, so checking on it won’t work. One way would be to have a variable with the absolute filename (say $realfile). You’d then have to alter your code and use this variable for the file checks:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement