上传mysql的codeigniter图片 [英] codeigniter image uploading mysql

查看:7
本文介绍了上传mysql的codeigniter图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如果我将 CodeIgniter 中的图像上传到数据库中,我的会是什么

I wanted to know if I was uploading an image in CodeIgniter to a database what would be my

$config['upload_path']

我看到的所有示例都使用文件系统.我在数据库中有文章,也想在数据库中存储与文章相关的图像.有人可以帮忙吗?

All the examples I have seen are using the filesystem. I have articles in a db and would like to store images relating to articles in the db as well. Can anyone help?

推荐答案

你可以阅读这个很棒的文章,叫做在 Mysql 中存储图像.

文章涵盖以下内容:

  • 这不是个坏主意吗?
  • 什么是 BLOB?
  • 创建图像表
  • 上传表单
  • 上传图片
  • upload() 函数
  • 显示数据库中的图像
  • 显示所有信息

但不要让您空手而归,请查看 Blob,它是 MySQL(和其他各种 dbms)中列的数据类型.这将允许您存储图像和其他二进制文件类型等数据.

But not to leave you empty handed, look into Blob, it's a data-type for colums in MySQL ( and various other dbms ). This will let you store data such as Images and other binary file-types.

在数据库中存储文件和图像的想法通常与将它们存储在文件系统中相同,只是上传和拥有实际文件之间的层不同.

The idea of storing files and images in the database is in general the same as storing them on the filesystem, the layer in-between upload and having the actual file is just different.

你不能只设置你的上传路径就希望一切都解决,你还需要弄些脏东西!

You cannot just set your upload-path and hope everything is solved, you need to get some dirt on your hands aswell!

这篇关于上传mysql的codeigniter图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆