How to store an image in database using MySQL?

PHP, MYSQL: Display the image from database to use the image path?

  • i am store the image path in database the image is stored in particular folder it is success  i need to retrieve the image it is not working properly  it is display only the path not image  please any body help me it is need for my project

  • Answer:

    u hv to use the html tag img for displaying of image otherwise use the header function of php

Sachin Dutt Maithani at Quora Visit the source

Was this solution helpful to you?

Other answers

Add a container. <div id="divGallary" style="position:relative;top:0" runat="server"></div> C# using System; using system.io; using System.Web.UI.HtmlControls; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { int iFileCnt = 0; System.IO.DirectoryInfo dirInfo = new System.IO.DirectoryInfo(Server.MapPath(".")); FileInfo[] listfiles = dirInfo.GetFiles("*.*"); if (listfiles.Length > 0) { foreach (FileInfo file in listfiles) { if ((listfiles[iFileCnt].Extension == ".jpg" || listfiles[iFileCnt].Extension == ".jpeg" || listfiles[iFileCnt].Extension == ".png" || listfiles[iFileCnt].Extension == ".bmp" || listfiles[iFileCnt].Extension == ".gif")) { HtmlImage img = new HtmlImage(); HtmlGenericControl newDiv = new HtmlGenericControl("div"); img.Src = listfiles[iFileCnt].Name; img.Width = 150; img.Height = 150; newDiv.Controls.Add(img); divGallary.Controls.Add(newDiv); } iFileCnt = iFileCnt + 1; } } } } http://Vb.Net Imports System.IO Partial Class _Default Inherits System.Web.UI.Page Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load Dim iFileCnt As Integer = 0 Dim dirInfo As New System.IO.DirectoryInfo(Server.MapPath(".")) Dim listfiles As FileInfo() = dirInfo.GetFiles("*.*") If listfiles.Length > 0 Then For Each file As FileInfo In listfiles If Trim(listfiles(iFileCnt).Extension) = ".jpg" Or Trim(listfiles(iFileCnt).Extension) = ".jpeg" Or _ Trim(listfiles(iFileCnt).Extension) = ".png" Or Trim(listfiles(iFileCnt).Extension) = ".bmp" Or _ Trim(listfiles(iFileCnt).Extension) = ".gif" Then Dim img As New HtmlImage Dim newDiv As New HtmlGenericControl("div") img.Src = listfiles(iFileCnt).Name img.Width = "150" img.Height = "150" newDiv.Controls.Add(img) divGallary.Controls.Add(newDiv) End If iFileCnt = iFileCnt + 1 Next End If End Sub End Class Arun http://www.encodedna.com/

Arun Kumar

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.