Welcome Guest, Not a member yet? Register   Sign In
Excel Upload via File Upload Library
#11

[eluser]Mr. Fulop[/eluser]
On WAMP adding to config/mimes.php this line:
Code:
'xls'   =>  array('application/vnd.ms-excel', 'application/octet-stream', 'application/msexcel', 'application/excel'),

helped me to upload the xls files whithout getting the invalid extension error.
("The filetype you are attempting to upload is not allowed")
#12

[eluser]Unknown[/eluser]
i use Firefox 3.6.3..

and i have the same problem with you. after all, i add this xls mime type, 'application/download'.
So, the mimes.php would be written like this:

'xls' => array('application/vnd.ms-excel [official]', 'application/msexcel', 'application/x-msexcel', 'application/x-ms-excel', 'application/vnd.ms-excel', 'application/x-excel', 'application/x-dos_ms_excel', 'application/xls', 'application/excel', 'application/download')
#13

[eluser]Unknown[/eluser]
[quote author="creoff" date="1207145127"]You can add

Code:
application/x-msexcel

to the list of MIME types as well. I got that one on my Windows XP machine just now.[/quote]


where can i find this list on xp machine. i have xp sp3
Thanks for the help
#14

[eluser]Lucas Alves[/eluser]
And for me, on firefox 3.6.8,running on windows XP sp3, xls files are been recognized as 'application/force-download'.

I have a doubt: Is this secure to check the file type by the mime type, since what determines this is the browser?

Aplication/force-download isn't correct to relate with XLS files beacause it could be any file.

Anyone knows how could I solve this problem?

Ps: In IE7 it works fine.
#15

[eluser]Unknown[/eluser]
Hi, I use CodeIgniter 1.7.2,
i found that image check code (in is_allowed_filetype function, line 566) was not on the right place. This cause the "The filetype you are attempting to upload is not allowed" problem for non image file (xls, doc, pdf, etc).

image check code :
// Images get some additional checks
if (in_array($val, $image_types))
{
if (getimagesize($this->file_temp) === FALSE)
{
return FALSE;
}
}

my solution was edit the libraries/upload.php, move the image check code to other place, see below
function is_allowed_filetype()
{
.
.
.
foreach ($this->allowed_types as $val)
{
$mime = $this->mimes_types(strtolower($val));

if (is_array($mime))
{
if (in_array($this->file_type, $mime, TRUE))
{
// Images get some additional checks
if (in_array($val, $image_types))
{
if (getimagesize($this->file_temp) === FALSE)
{
return FALSE;
}
}
return TRUE;
}
}
else
.
.
.
}

Hope this solution will solved your problem
#16

[eluser]The Right Gang[/eluser]
thank's summer_student
i was looked for this solution and it take all day for me just for upload file.
thanks' ... many many thanks

i like this message 'You did not select a file to upload'
you have took me all day
#17

[eluser]meenxo[/eluser]
Sorry if I am resurrecting an old post. I had the same issue until I added the following mime to "xls" in Mimes.php:
Code:
application/vnd.ms-office

Just in case someone else is experiencing the same issue.




Theme © iAndrew 2016 - Forum software by © MyBB