doucuoyan0426
2011-09-01 15:55
浏览 109
已采纳

CodeIgniter(和allowed_types)的问题

Morning guys.

I'm trying to use Plupload along with CodeIgniter. I tried uploadify before Plupload and it worked awesome, the main problem with uploadify is that it never sent the CSRF code, no matter what I used, this was really odd so I reviewed Plupload and I made it work as expected in matter of minutes. However, it ONLY works well with the HTML5 uploader and not with the Flash Uploader.

Reviewing the logs I found the reason why it was not working: while using the CodeIgniter File Uploading Class.

Since I'm doing a bulk image uploader I set it up to allow "jpg,gif,png,jpeg" but found that the uploader rejects the uploading petition since I'm uploading a wrong type_file (which I found is octet/stream - wtf?).

After the upload process, I was processing the image (generating thumbs, watermarks, cropping, etc) so if I set it to allow all file types, the image processing won't work at all.

What I was thinking was on doing something like upload the file (allowing octet/stream MIME TYPE) then convert it to image (with imagecreatefromstring and file_get_contents functions) and then process it individually.

If you have any other idea let me know

图片转代码服务由CSDN问答提供 功能建议

早上好。

我正在尝试使用Plupload和CodeIgniter 。 我在Plupload之前尝试了uploadify,它工作得很棒,但是uploadify的主要问题是它从未发送过CSRF代码,无论我使用什么,这都很奇怪,所以我评论了Plupload,我让它在几分钟内按预期工作。 但是,它只适用于HTML5上传器,而不适用于Flash上​​传器。

查看日志我发现它无法正常工作的原因:使用CodeIgniter文件上传类时。 / p>

由于我正在进行批量图像上传,我将其设置为允许“jpg,gif,png,jpeg”,但发现上传者拒绝上传请求,因为我上传了错误 type_file(我发现是octet / stream - wtf?)。

在上传过程之后,我正在处理图像(生成拇指,水印,裁剪等),所以如果我设置它 为了允许所有文件类型,图像处理根本不起作用。

我在想的是做上传文件(允许octet / stream MIME TYPE)然后转换它 to image(使用imagecreatefromstring和file_get_contents函数),然后单独处理。

如果您有任何其他想法,请告诉我

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题