syntax
Posted: Fri Aug 03, 2007 8:41 am
I have a file name as below.
I want to check a file name before it uploads.
----------------------------------
file name is test12345_11.txt and it keeps the first four strings and file name..
12345_11 will be changable
-----------------------------------
this is a code that i am trying.
Can you check the syntax and is it correct way?
if(substr(basename($_FILES['upload']['name']),0,3) != 'test') && substr(basename($_FILES['upload']['name']),-4) != '.txt'))
{
echo '<br><INPUT TYPE="button" VALUE="Back" onClick="history.go(-1);return true;">';
exit;
}
I want to check a file name before it uploads.
----------------------------------
file name is test12345_11.txt and it keeps the first four strings and file name..
12345_11 will be changable
-----------------------------------
this is a code that i am trying.
Can you check the syntax and is it correct way?
if(substr(basename($_FILES['upload']['name']),0,3) != 'test') && substr(basename($_FILES['upload']['name']),-4) != '.txt'))
{
echo '<br><INPUT TYPE="button" VALUE="Back" onClick="history.go(-1);return true;">';
exit;
}