how to filter filename in file upload

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
greedyisg00d
Forum Commoner
Posts: 42
Joined: Thu Feb 12, 2009 2:48 am

how to filter filename in file upload

Post by greedyisg00d »

I have a standard format for my filename which is

user1_name_date

for example:

user1_greedy_09202009

Thus when the user browse for a file with a different filename format it will display an error "Invalid filename format". Any idea on how can this be done. Thanks
amargharat
Forum Commoner
Posts: 82
Joined: Wed Sep 16, 2009 2:43 am
Location: Mumbai, India
Contact:

Re: how to filter filename in file upload

Post by amargharat »

you can check file type as follows

Code: Select all

$_FILES["filename"]["type"]
greedyisg00d
Forum Commoner
Posts: 42
Joined: Thu Feb 12, 2009 2:48 am

Re: how to filter filename in file upload

Post by greedyisg00d »

Thanks but I am referring to the "file name" not the "file extension"
Post Reply