MySQL Forums
Forum List  »  PHP

Re: images
Posted by: William
Date: April 13, 2006 04:45AM

Ryan Chles wrote:
> I rechecked my code, and everything is in proper
> order and the spelling is correct and all
> variables are correct in the actual code. Does
> anyone know how to upload images to a database?
> the colum is actually empty and this may be the
> issue, but no matter what I do, it won't display
> their.
>
> imryn


First you need to read the files data into a variable and check the file name and put that data in a variable, for example:
$file_data="data";
$file_ext="jpeg";
$type=[function which has list of types and extensions and returns correct content-type value]($file_ext);
// [Write data to database]
// display data
$header="Content-type: $type\n\n"; // read the type variable that you stored in mysql into here.
$extra="$file_data"; // read file data from mysql
$finish=$header+$extra; // Combine variables. I don't know how to combine two variables but you can adapt the code.
print "$finish"; // print the data.

You can adapt the code.
To include it as an image, save the part of your code that reads from mysql and displays the data as something.php or anything, as long as its got .php extension and then link the image to the php file like so:

<img src="something.php">

It should now work.
Reply if it doesnt.

No, I will NOT fix your computer!
Oh, alright then!

I HATE it when things go wrong :@ :@

Options: ReplyQuote


Subject
Written By
Posted
April 10, 2006 06:01PM
April 11, 2006 03:24AM
April 11, 2006 03:30AM
April 11, 2006 03:03PM
April 12, 2006 04:35PM
Re: images
April 13, 2006 04:45AM
April 13, 2006 01:53PM
April 13, 2006 06:59PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.