codeigniter image上传mysql [英] codeigniter image uploading mysql

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

问题描述

我想知道如果我在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


The article covers the following:


  • 这不是一个坏主意吗?

  • 什么是BLOB? / li>
  • 创建图片表格

  • 上传表单

  • 上传图片

  • 上传()函数

  • 显示数据库中的图片

  • 显示所有信息


    • Isn’t this a bad idea?
    • What is a BLOB?
    • Creating an image table
    • The upload form
    • Uploading the image
    • The upload() function
    • Display an image from the database
    • Displaying all the information

    但不要让你空手,看看 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!

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

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