3

我想上传一个 .c 文件。我正在使用 CodeIgniter。我正在使用的代码适用于 .pdf 但每当我尝试上传 .c 文件时,它都会显示“不允许您尝试上传的文件类型。”。

我的代码如下:

$config = array
(
    'upload_path' => './solutions',
    'allowed_types' => 'c',
    'file_name' => $file_name,
    'file_size' => 1000,
    'remove_spaces' => 'true'
);
$this->upload->initialize($config);

当我以允许的类型编写 pdf 时,它可以工作,但在 C 的情况下则不行。

4

1 回答 1

4

在 allowed_types 中,您需要具有 MIME 类型。

对于将是“text/plain”的 ac 源文件,因为没有“c”MIME 类型。

http://en.wikipedia.org/wiki/Internet_media_type

于 2012-11-01T23:28:56.903 回答