Quote:
Originally Posted by mpikounis
Ok, this may have been answered before but I have been searching this thread for about 1 hour now and I cannot find anything similar :-)
It all works fine except when you upload an image it does not display it. Instead I get a red X. Looking at the database the row is there BUT the size of the "data" field is 0. Any ideas? Please?
|
I managed to make this work so here is how if anyone else runs into the same problem:
My guess was that uploads were failining due to the fact that my service provider is using SAFE_MODE. Looking at the file upload code of vbulletin I did the following changes to vbgarage.php:
Look for
$name = $_FILES['src']['name'];
$data = addslashes(fread(fopen($_FILES['src']['tmp_name'], "r"), filesize($_FILES['src']['tmp_name'])));
$type = $_FILES['src']['type'];
and replace with
// make up a temporary name
$tmp_name = 'vbupload' . substr(TIMENOW, -4);
// check file exists on server
if ($vboptions['safeupload'])
{
$path = $vboptions['tmppath'] . "/$tmp_name";
if (move_uploaded_file($_FILES['src']['tmp_name'], $path) AND file_exists($path))
{
$filename = $path;
}
}
else if (file_exists($upload))
{
$filename = $_FILES['src']['tmp_name'] ;
}
$name = $_FILES['src']['name'];
$data = addslashes(fread(fopen($filename, "r"), filesize($filename)));
$type = $_FILES['src']['type'];
Now... this worked with my server that uses SAFE_MODE. I am not sure it will work if SAFE_MODE is not used, I haven't tried it!