Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
04-02-2007, 12:25 PM #1
- Join Date
- Dec 2005
- Thanked 0 Times in 0 Posts
inserting image or other data in the database ??
Hello forums !!
I know its not the best way to store mime data in the mysql but the database is designed so i have to go that way.
I didnt have the idea to store and retrieve the mime data in the mysql.
Can anybody guide me in such case ??
Thanks in advance to all of you !
04-02-2007, 01:22 PM #2
- Join Date
- Mar 2007
- Thanked 19 Times in 19 Posts
You will have to use LONGBLOB fields to store the binary data.
If you are using an uploader, like ASPUpload, you will have to store the binary data from the upload.form() method.
To retrieve the data, you will have to use a BinaryWrite or "application/" HTTP header to retrieve the data.
In PHP:Code:<% Response.ContentType = "application/image-jpg" 'change to suit your file type Response.BinaryWrite fldName %>
You can also use this method to push PDF files (as seen above) and any other information that you feel necessary (Documents, Spreadsheets, Images, etc).Code:<?php $fpd = "path2file" . $fp . ".pdf"; $len = filesize($fpd); header("Content-Type: application/pdf"); // change to suit your file type header("Content-Disposition: inline; filename=$fpd"); header("Content-Title: $fpd"); header("Content-Length: $len"); readfile($fpd); ?>