I have a bunch of image files in a directory tree, kind of spread out. Now I have a script that cycles trough the filesystem and check if the file is an imagefile. If it is I store it in my database (MySQL). The script works fine up to the point where my other script getImage.php tries to retrieve the picture and show it in the browser. After alot of testing I found out that it is not the getFile.php script that is wrong since it works with files that I've uploaded using a regular form upload. So my problem must be in the filesystem to database script.
this is how I do it:
#cycles trough the filesystem and finds image files (works)
//read the file into a variable
$imageFile = fread(fopen($filePath, "r"), filesize($filePath));
//Inserts the whole thing into my database
"INSERT INTO images (name, fileName, binaryFile, fileType) VALUES ('whatever', '$fileName', '$imageFile', '$fileType')";
Now everything looks good in the database, filetype is set to "image/gif" and everything else seems fine. If you can't se a problem with the code please give me an idea on how to track the error.