PDA

View Full Version : help in PHP-mysql


bukaida
01-11-2006, 11:40 PM
I want to insert an image as long blob in mysql4.0. I am using php 4.4 with apache 2 under winXP.
The following script I am using for inserting the image which is not working.
I have changed the buffer and global settings(output_buffering = on and register_globals = on) in php.ini file but with no result. Kindly see the attachment and please help.

bukaida
05-11-2006, 09:10 PM
A bump for all??

mediator
05-11-2006, 11:12 PM
http://hockinson.com/index.php?s=37

But I wud recommend to store them in server folders n use em from there!

bukaida
07-11-2006, 10:10 PM
I found a good solution with working script(Yes working script) which I want to share with you guys.please see the attachment or click
http://www.dreamwerx.net/phpforum/?id=1


Thanx Mediator, indeed I was also thinking about the same as it is said that unless you are having a good pattern recognition software which can identify a rose from a picture of garden, storing image in database is not a very good idea. Another problem is the size restriction. I want to store a scanned image (in tiff format) which has approximately 35 to 40MB size. This is very very difficult if i use the database.So your solution will be very helpful. can you provide me a script or a link? Thanx in advance.

mediator
08-11-2006, 12:19 AM
@bukaida : See u can store the image in a folder and develop a php script so that u can manually enter the filepath of that file and make it as a link!

To make an existing file as a link (so that u can open it via link) here's the script!


<?php
$filename="path/xyz.jpg";
if (file_exists($filename)) echo "<a href=\"$filename\">$filename</a>";
?>


Here instead of "path/xyz.jpg" u can retrieve the filepath from some Form where u can enter the filepath more conveniently! Then instead of "path/xyz.jpg" it wud be $_POST["file"] where file is a variable of the form!

U can use this idea to insert the filepath in mysql and retrieve it from there and make it a link !!

bukaida
08-11-2006, 12:27 PM
@mediator: Got your idea but can it be used to upload the image file. I mean the image is in client's machine and it should be uploaded to a remote folder at the server so that another client can download and use it.Can you help?

mediator
08-11-2006, 01:19 PM
@bukaida : Sorry dood, I haven't yet tried the remote upload part of php yet! U can manually ftp to upload the file or follow this link (http://www.w3schools.com/php/default.asp)! See the php ftp n http section on left hand side!

kalpik
08-11-2006, 03:20 PM
if ($_FILES['imagefile']['type'] == "image/jpg"){
copy ($_FILES['imagefile']['tmp_name'], "files/".$_FILES['imagefile']['name'])
or die ("Could not copy");


This is something i made a long time back. See if it works for you, the code is self explanatory.