Web hosting provider - USING PHP TO MANAGE FILES The first two
USING PHP TO MANAGE FILES The first two lines assign the target folder to a variable and call getNextFilename5() (use getNextFilename4() for PHP 4) to generate the next filename in the series. The function runs a number of checks on the three arguments and returns false if any fail. So the next section of code is wrapped in a conditional statement to ensure that the script attempts to create a new file only if a valid filename is obtained. The call to fopen() is enclosed in another conditional statement. This checks that the file has been successfully created before attempting to write to it. If the file can t be opened, a suitable message is assigned to $result. The final else clause belongs to the following conditional statement: if ($filename) { So, if getNextFilename() returns false, $result reports the likely reasons for failure. 5. Insert the following PHP code between the opening
and