Reputation: 23
Hi how do i allow only word documents? And i mean both mime-type and extension? Right now i have these codes checking extensions for .txt files, how do i change it to accept only word docs.
if ($uploaded_type !=="text/plain")
and
if($ext !== 'txt')
Upvotes: 2
Views: 5626
Reputation: 2262
I belive https://www.php.net/manual/en/function.finfo-file.php is what you are looking for
Upvotes: -1
Reputation: 388253
application/msword
for .doc
and application/vnd.openxmlformats-officedocument.wordprocessingml.document
for .docx
.
See http://filext.com/faq/office_mime_types.php
Upvotes: 1
Reputation: 180136
MS Word documents are application/msword
or application/vnd.openxmlformats-officedocument.wordprocessingml.document
mime types and doc
or docx
extensions.
Upvotes: 2