Welcome Guest, Not a member yet? Register   Sign In
File Upload Class File type problem


I'm trying to allow .log files to be uploaded but when specified it doesnt seem to matter, the same error appears "filetype you are attempting to upload is not allowed"
$config['allowed_types'] = 'txt|log';

any help is much appreciated

I tried changing the file name before initilizing the upload class like this:
$tmp = substr($_FILES['userfile']['name'], 0,(strpos($_FILES['userfile']['name'],'.')+1));
$_FILES['userfile']['name'] = $tmp . 'txt';

But doesn't work, must be something in the temp name, any thoughts how I can fix this? If I change the files to .txt they upload fine, when they're .log it errors out every time.


no one has any ideas?

In $this->upload->data(), file_type should be either 'text/plain' or 'text/x-log' (case sensitive), what is it?

[file_name] =>
[file_type] =>
[file_path] => ./uploads/
[full_path] => ./uploads/
[raw_name] =>
[orig_name] =>
[file_ext] =>
[file_size] =>
[is_image] =>
[image_width] =>
[image_height] =>
[image_type] =>
[image_size_str] =>

$config['allowed_types'] = 'txt|log';

A sample of the log file being uploaded is attached... i change from .log to .txt works great, but something isn't working right with .log; I had to zip the file, CI wont let me upload .log to the forum.

Figured it out, for some reason the
for .log files is application. I manually change the type to text/plain before initializing the uploads library and works fine.

a bug?

Theme © iAndrew 2016 - Forum software by © MyBB