Welcome Guest, Not a member yet? Register   Sign In
Uploading file with .do extension
#1

[eluser]Computerzworld[/eluser]
Hello I am having one file which is having .do extension and I want to upload it to my server using CI upload library. But it doesn't allow me to upload the file. If I convert it to .htm extension then it allows me to upload. How can I solve this problem? Please help me. Thanks in advance.
#2

[eluser]Kromack[/eluser]
Hello,

Have you set the library to allow the do extension ?

Something like this :

Code:
$config['allowed_types'] = 'gif|jpg|png|do';

Good luck
#3

[eluser]xwero[/eluser]
To add it to the allowed type you have to put the extension and the mime type in the config/mimes.php file.
#4

[eluser]Computerzworld[/eluser]
yup I have already set it in the $config['allowed_types'] but I don't know what is the mime type of .do file...
#5

[eluser]xwero[/eluser]
you can check it using
Code:
if(count($_POST)>0)
{
   echo $_FILES['userfile']['type'];
}
$this->load->helper('form');
echo form_open_multipart('controller/method').form_upload('userfile').form_submit('','get mime').form_close();

Do the checks in all browsers on your computer, particularly IE has some weird mime type output.
#6

[eluser]Computerzworld[/eluser]
thanks a lot... it really helped me and now I am able to upload the file with .do extension.
here is what I have did in order to upload this kind of file in mimes.php

Code:
'do'    =>  array('application/octet-stream','text/plain')

Mozilla treats .do file's mime type as 'application/octet-stream' and IE treats it as 'text/plain'...
#7

[eluser]Computerzworld[/eluser]
i m getting new problem while defining this mime type in mimes.php. Now it doesn't check for file extension for any file and it allows all files to be uploaded Sad as soon as I remove this from mimes.php it checks for file extension which I have provided in $_config['allowded_types']. Now what should be the problem behind this? Please help me. Thanks once again....




Theme © iAndrew 2016 - Forum software by © MyBB