Hi frnds really i dont know how to vote today i came to know,dont neglate my que thinking i have not accept...i am begginer to development i want to upload only image to database and that i need to fetch and display..i should fetch directly image and display can anyone please help me out thank in advace
A:
I don't recommend storing binary data in a database. Upload your image to the filesystem and store a locationstring in your database. Then query your table, fetch the results and put $result["location"]
in your <img src=""/>
tag. This, of course only works when you fetch your query-result associative in $result
and you have a column location
in your table ;)
And you should really start giving votes and accepting answers, you've asked 27 question and none of them have an accepted answer. This makes people less willing to help you!
Ben Fransen
2009-11-27 10:01:47
A:
Example for storage:
$f = file_get_contents(FILENAME);
$size = filesize(FILENAME);
$m = new mysqli(HOSTNAME,USERNAME,PASSWORD,DATABASE);
$m->query('INSERT INTO images (data,size) VALUES ("'.$m->real_escape_string($f).'",'.$size.')');
Peter Lindqvist
2009-11-27 10:17:25