Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,190,352 members, 7,940,381 topics. Date: Thursday, 05 September 2024 at 01:45 AM

How Do I Upload A Picture Into My Database In Php And Coldfusion - Webmasters - Nairaland

Nairaland Forum / Science/Technology / Webmasters / How Do I Upload A Picture Into My Database In Php And Coldfusion (935 Views)

How To Upload A Song(your Song) Or Other Application Or File To Waptrick / How Can I Link A Form In My Website To A Table In My Database / Form Validation Tutorial Using Javascript, Php And Ajax! (2) (3) (4)

(1) (Reply) (Go Down)

How Do I Upload A Picture Into My Database In Php And Coldfusion by lejandro: 7:56pm On May 26, 2009
Hi evry one how do I upload a picture into my database using the cffile tag in coldfusion and also in PHP. I only know how to write d script dat uploads to a directory but I don't know how to write d script dat uploads into my database. Pls help I'm stucked it's urgent.
And where and How do I get Free ebooks on Visual Basic ASP.Net?
Re: How Do I Upload A Picture Into My Database In Php And Coldfusion by nitation(m): 9:28pm On May 26, 2009
why not upload to a directory and store the image file name to the DB. What about that??
Re: How Do I Upload A Picture Into My Database In Php And Coldfusion by segsalerty(m): 10:56pm On May 26, 2009
take to nitation's advice
bye
Re: How Do I Upload A Picture Into My Database In Php And Coldfusion by Nobody: 1:01am On May 27, 2009
From experience, I will take to Nitation's rule
there are more advantages to that rule

but if you still want it ur way.
then regardless of what language you use, all you need to is read the image file (strictly in binary)
push the result to your database.
note that only blob type will work, i prefer mediumblob cos it will hold more, and longblob for extreme large High res walpapers

how ur database handles it depend, mysql will store ur binary data in hexadecimals meaning, you will end up with double the original size since 2 hex characters go for 1 ascii.
so if you push it to ur database and it doesn't convert it
then fire up ur language documentation and see if they ve got binary conversion

when outputing also, you need to see what works and what doesnt


I worked on something similar lately and i noticed while using mysqlDB module for python
when i push my binary to mysql, the binary always contain some characters well known to mysql and this always result to syntax errors.

so the only option was to do the conversion to hex right inside python, then use something like UNHEX(0x3U64Y8, ) to tell mysql to convert it back
but funny, when i need to retrieve it, it comes to me in binary. I dont know if it's mysql doing the conversion or python. I just dont care.
Re: How Do I Upload A Picture Into My Database In Php And Coldfusion by Nobody: 10:46am On May 27, 2009
I prefer nitations advice too, better than all them blobs and all that. . . bye. . .
Re: How Do I Upload A Picture Into My Database In Php And Coldfusion by Nobody: 2:24am On May 29, 2009
what are ur reasons for loving that approach if i may ask?
Re: How Do I Upload A Picture Into My Database In Php And Coldfusion by Nobody: 10:19am On May 30, 2009
Kinda simplier to use i suppose. . . especially for newbies like me!
Re: How Do I Upload A Picture Into My Database In Php And Coldfusion by Nobody: 5:29pm On Jun 01, 2009
lol, you call urself newbie?

well for me,
some of the reasons are
1. say u need to use the images offline on a target system without all ur developer junks, You dont want to start installing a webserver, and writing codes to convert d images back to jpeg.
2. By storing them in DBs, the images take up twice its original size. so u may be using up 200GB when u shud be using 100GB
3. I think, You will be consuming more database resources while transferring
4. database backup becomes more hectic, to download the backup sef, while using FTP to backup the images folder could be a better approach
those i can think of.
Re: How Do I Upload A Picture Into My Database In Php And Coldfusion by Nobody: 10:32am On Jun 02, 2009
Dat is quite interesting.

(1) (Reply)

Problem: Site Definition In Dreamweaver / Webmasters, It Is Time To Show Us Your Wordpress Sites! / Whats Up With Nairaland These Days?

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 14
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.