Jump to content

help with PHP file


DanDaBeginner

Recommended Posts

:) I dont know how to do this can someone give a tutorial or a specific function in PHP on how to know whether

what file is elready existing in the folder..

--------------------------------------------------

for example:

folder name: 'data'

contents of 'data/' :

                  Data1.txt, Data2.txt, Data3.txt

--------------------------------------------------

I want to check it, so I can create a file next to the last file, so the new file would be 'Data4.txt';

 

thnx in advance

 

 

Link to comment
https://forums.phpfreaks.com/topic/44121-help-with-php-file/
Share on other sites

:) thanx Crusader ... got it now..for those who need, check this one:

 

this is the code:

<?php
	$check = FALSE;
	$a = 1;
	$path ='files/DATA';
	while ($check != TRUE) {
		if (!file_exists('files/DATA'.$a.'.txt')) {
			$path = 'files/DATA'.$a.'.txt';
			$check = TRUE;
		}
		$a++;
	}
	echo $path;
?>

anyone that has a faster code than the one I have? plz post.. thanx

Link to comment
https://forums.phpfreaks.com/topic/44121-help-with-php-file/#findComment-214239
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.