Hi,
this was a general question: I don't know if what I did is wrong but I'm confused.
I am counting files in a directory so that people can't upload more than x number of files without deleting some.
What I have noticed is that the first time I upload a file '$count' is given as 1 (echoed).
The second time is also 1, then 2 etc.
I realised that I was counting the files BEFORE saving the new upload to the directory in question, so that explained why my echoes always were 1 behind the real value, but I cannot figure out why it says '1' the FIRST time, when the directory is empty.
If it was counting a 'hidden' file or something, wouldn't it carry on from there: 1,2,3.... Likewise, if it's counting the uploaded (but not saved) file?
My server is running on Linux, if that makes a difference.
I was thinking this might be a general knowledge type thing rather than the code. I haven't tried working with files before and there seems to be a lot I don't know.
here is the relevant part of my script if it helps ...
Bookmarks