Sunday 15 September 2013

php - file manager - reading content of a folder -


I have a problem, reading files from a folder (in this case 'upload'):

This script is:

  & lt; Div id = "content" & gt; & Lt ;? Php echo " This is a list of files: "; $ Dir = dir ("Upload"); While (($ file = $ dir- & gt; read ()) == Incorrect) {echo " Close (); ? & Gt; & Lt; / Div & gt;   

And its result:

  This is a list of files: file name :. File Name: .. File Name: Prova.txt File Name: prova2.txt File Name: prova3.txt File Name: prova4.txt   

This works because Folders to this content. But how can I avoid showing the first two lines? What are these two lines? Why do they appear?

Try it out:

  while (($ File = $ dir -> Read ())! == Incorrect (if ($ file! = '.' And $ file! = '..') {echo " File name:" $ file "& Lt; / p & gt;"; }}    

No comments:

Post a Comment