Question

I am writing a PHP page to convert an uploaded file to XML. I only want to convert the news file to XML. The only file that ever needs to be converted is news.htm. I have narrowed my problem down to this if statement. What is wrong with it?

$fileName = basename( $_FILES['uploaded']['name'] );

if( strcmp( $fileName, "news.htm") == 0 )
(
    //convertToXML();
)
Was it helpful?

Solution

Use curly braces around the body of the if statement, instead of parentheses:

if( strcmp( $fileName, "news.htm") == 0 )
{
    //convertToXML();
}

OTHER TIPS

Try:

$fileName = basename( stripslashes( $_FILES['uploaded']['name'] ) );
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top