Page 1 of 1

Defining and reading a file.

Posted: Fri Jun 10, 2005 1:51 am
by SkyFlyer
I am editing a script for a friend.

Code: Select all

<?php

$file1="1.txt"; //Text file for trial purposes... should be in the same directory as
$file2="2.txt";
How do I define the file to read the txt no matter what it is called? Such as a wild card.

$file1="*.txt"; Would this work?

Posted: Fri Jun 10, 2005 2:13 am
by Syranide
you cannot read any file, that would be slightly strange.
I don't see why you would want that either.

If you want to read each file in a folder you have to get all the files in the folder, uhm can't remember the function for that right now.

Posted: Fri Jun 10, 2005 7:28 am
by Revan
scandir();

array scandir ( string directory [, int sorting_order [, resource context]] )

then just remove the extra entrys with string functions.

Posted: Fri Jun 10, 2005 7:51 am
by malcolmboston

Posted: Fri Jun 10, 2005 3:01 pm
by SkyFlyer
What the script is for is an online sports league. It reads text files, and uploads the information to a database. I can post the entire script if you wish. It is a little long, and like I said, I did not write it. I am only making modifications to it.


BTW thanks for helping on this :)