By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,636 Members | 1,784 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,636 IT Pros & Developers. It's quick & easy.

file upload for .vcf format in php

P: 7
hai everyone

can any one help me in writing code for file upload to accept .vcf format only
in php


thanks and regards
ajay kumar k
Feb 9 '07 #1
Share this Question
Share on Google+
1 Reply


P: 99
You have to check the mime type and you could check the extension as well

[PHP]
$ext = strtolower(strrchr($_FILES['card']['name'],'.'));
if($_FILES['card']['type'] == 'text/x-vcard' && $ext == '.vcf'){
// process file
}
[/PHP]
This method isn't 100% bulletproof because there are other mime types and the type in $_FILES is returned by the browser so it can be manipulated.

other mime types : http://filext.com/detaillist.php?extdetail=VCF
Feb 9 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.