hi,
i need the code for upload the file in davabase and server with word formate(.doc extension) only.when i download it, it should open in word formate(.doc extension) only.
Please help to me.
Thanks.
code for upload file with .doc extension formate
Moderator: General Moderators
This is a good tutorial to upload files
http://www.zend.com/zend/spotlight/uploading.php
The other step is you want to upload only .doc. You can implement a simple check for it.
http://www.zend.com/zend/spotlight/uploading.php
The other step is you want to upload only .doc. You can implement a simple check for it.
Code: Select all
if($_FILES['file_to_upload']['name'] != "") {
$file_name = $_FILES['file_to_upload']['name'];
$ext = explode(".", $file_name);
$file_ext = $ext[1];
if($file_ext == "doc") {
// your code here
}
else
$error_format = "invalid format";
}Do not rely on the value of $_FILES[...]['name'] or $_FILES[...]['type']. These are values the client sends and are not checked server-side.
If available use mime_content_type or the fileinfo extension
If available use mime_content_type or the fileinfo extension
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact: