upload to database issue

MasterMax1313

New Member
Messages
84
Reaction score
0
Points
0
I'm trying to make a simple upload site, where a user can upload an image to my database (longblob). I've upgraded to Intermediate (v2), so my upload size (and i suppose timeout). However, I'm having issues with my php. The code is below. The issue I'm having is that it won't upload with sizes near a megabyte and larger. My internet speed from where i'm working is fine, so my question is; what could be going wrong? Any thoughts? (I realize that not all of the code is there, but from what I can tell, the important part is [connection string works, i close the connection, etc.])

PHP:
if(isset($_POST['upload']) && isset($_POST['desc']) && isset($_POST['fname']) && isset($_POST['lname']))
{
        $fileName = mysql_real_escape_string($_FILES['userfile']['name']);
        $tmpName  = mysql_real_escape_string($_FILES['userfile']['tmp_name']);
        $fileSize = mysql_real_escape_string($_FILES['userfile']['size']);
        $fileType = mysql_real_escape_string($_FILES['userfile']['type']);
        $FirstName = mysql_real_escape_string($_POST['fname']);
        $LastName = mysql_real_escape_string($_POST['lname']);
        $Description = mysql_real_escape_string($_POST['desc']);
        $Date = date("mdY");
        echo $date;
        
        
        $extensionCheck = "";
        
        for($i = strlen($fileName) - 4; $i < strlen($fileName); $i++)
        {
            $extensionCheck = $extensionCheck.$fileName[$i];
        }
        $extensionCheck = strtolower($extensionCheck);
        if(($extensionCheck == ".jpeg") || ($extensionCheck == ".jpg") || 
            ($extensionCheck == ".gif") || ($extensionCheck == ".pdf"))
        {
            $fp = fopen($tmpName, 'r');
            $content = addslashes(base64_encode(fread($fp, $fileSize)));
            $content = addslashes($content);
            fclose($fp);
            
            if(!get_magic_quotes_gpc())
            {
                $fileName = addslashes($fileName);
            }
            
            $query = "INSERT INTO tshirts (description, picData, filename, filesize, filetype, Fname, Lname, uploadDate ) ".
                     "VALUES ('$Description', '$content', '$fileName', '$fileSize', '$fileType', '$FirstName', '$LastName', '$Date')";

            mysql_query($query) or die('Error, query failed');                    
            //include 'library/closedb.php';
            mysql_close($connect);
Edit:
is it possible that i need to request that my upload time out be increased?
 
Last edited:
Top