+ Reply to Thread
Results 1 to 1 of 1

Thread: upload to database issue

  1. #1
    MasterMax1313's Avatar
    MasterMax1313 is offline x10Hosting Member MasterMax1313 is an unknown quantity at this point
    Join Date
    Oct 2007
    Posts
    84

    upload to database issue

    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 Code:
    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 by MasterMax1313; 10-21-2007 at 07:13 PM. Reason: Automerged Doublepost
    If you found this helpful, don't be afraid to add to my rep
    ____________________________

    There are only 10 types of people in this world...

    Those who understand binary,
    And those who don't

+ Reply to Thread

Similar Threads

  1. PHP BB 2.0.16 Manual instalation
    By GFIV in forum Free Hosting
    Replies: 8
    Last Post: 09-14-2005, 12:40 PM
  2. Database Mysql
    By TheCentaury in forum Free Hosting
    Replies: 3
    Last Post: 08-23-2005, 09:55 PM
  3. I cant restore a mysql database
    By Revolution in forum Free Hosting
    Replies: 3
    Last Post: 07-24-2005, 01:27 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers