Upload filetype not allowed?? |
[eluser]123wesweat[/eluser]
Hi, i have set these filetypes as allowed Code: $config['allowed_types'] = 'doc|docx|gif|jpeg|pdf|jpg|rtf|txt|text'; filetypes .doc .docx jpg gif jpeg all upload correct but .pdf .txt .text .rtf doesn't upload??? How can i fix this?? btw this is my htaccess Code: <IfModule mod_rewrite.c>
[eluser]rogierb[/eluser]
Check the mimes.php. See what types are set for .txt .rtf etc. Then check your files to see if the mimes match. If they are not in mimes.php, add them:-)
[eluser]123wesweat[/eluser]
hmm, mimes.php reads Code: 'txt' => 'text/plain', looks good to me. How can i check the mime type of a file i am uploading??? I tried Code: $uploadFile = $this->upload->data(); Any other suggestions??
[eluser]hqhdn[/eluser]
Quote:How can i check the mime type of a file i am uploading??? You can try to use: Code: $_FILES[name]['type']
[eluser]rogierb[/eluser]
You can echo the upload array with $this->upload->data(); An explanation of the array can be found in the userguide. http://ellislab.com/codeigniter/user-gui...ading.html
[eluser]hqhdn[/eluser]
In this case: $this->upload->data() is NULL because the file doesn’t uploaded. You only can get information from $this->upload->data() until the file was uploaded on server. You can see it in library/Upload.php Code: // Set the uploaded data as class variables
[eluser]rogierb[/eluser]
The file type is checked after that part of code. I guess should be filled... What error message do you get when uploading the files?
[eluser]123wesweat[/eluser]
this is the error i get Code: Array ( [error] =>
[eluser]rogierb[/eluser]
hmm, weird. What you can do is temporarily edit Upload.php Code: print_r($_FILES); Just to see what $_FILES produces and what file_type CI creates.
[eluser]123wesweat[/eluser]
hmm, .txt gives Code: Array ( [userfile] => Array ( [name] => test.txt [type] => text/plain [tmp_name] => /tmp/phpFua8uJ [error] => 0 [size] => 92 ) ) text/plain .rtf gives Code: Array ( [userfile] => Array ( [name] => test_upload.rtf [type] => text/rtf [tmp_name] => /tmp/phptEheEf [error] => 0 [size] => 2207 ) ) text/rtf .pdf gives Code: Array ( [userfile] => Array ( [name] => route.pdf [type] => application/pdf [tmp_name] => /tmp/php6b4ubb [error] => 0 [size] => 84853 ) ) application/pdf All look ok to me. |
Welcome Guest, Not a member yet? Register Sign In |