Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Jan 2007
    Posts
    2

    Question Upload picture to cPanel PHP/MySql

    Hi,

    I'm new to cPanel forums so I'm sure if I'm asking this question in the right place. I've set up a database in MySql and I wrote a PHP script to upload pictures in to the database. The problem is that when I submit the form to upload the picture, the variable that stores the file name is blank. All of the other fields from the form submit fine and store the value into the databse fine. Can I not use [CODE<input type="file" name="pict_url" value="<?php echo $pict_url; ?>" size="50">[/CODE] to submit to the database? It works great on my local machine.

    When the form is submitted it is supposed to measure the width of the picture and if it is larger than a specified width it will go thru a script to resize the picture and then store it to the databse.

    PHP Code:
        if($width 400){
                
           
    // This is the temporary file created by PHP 
              
    $uploadedfile $_FILES['pict_url']['tmp_name'];
                            
                            
        
    // Create an Image from it so we can do the resize
        
    $src imagecreatefromjpeg($uploadedfile);
                            
        
    // Capture the original size of the uploaded image
                            
        
    list($width,$height)=getimagesize($uploadedfile);
                            
        
    // resize the image
                            
        
    $newwidth=400;
        
    $newheight=($height/$width)*400;
        
    $tmp=imagecreatetruecolor($newwidth,$newheight);
                        
        
    // this line actually does the image resizing, copying from the original
        // image into the $tmp image
        
    imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height); 
                        
        
    // now write the resized image to disk. I have assumed that you want the
        // resized, uploaded image file to reside in the ./images subdirectory.
        
    $filename "../images/"$_FILES['pict_url']['name'];
        
    imagejpeg($tmp,$filename,100);
                            
        
    imagedestroy($src);
        
    imagedestroy($tmp);
                        

         } 
    Are there some limitations using the cPanel MySQL/PHP because PHP is configured to not accept file uploads?

    Again, if I'm asking this question in the wrong place, I do apologize.

    Thanks

  2. #2
    Member
    Join Date
    Mar 2006
    Posts
    378

    Default

    so far I have not see any problems with our client's Cpanel box with their PHP/MySQL to upload files to the server. If you are suspecting the issues on your PHP, check your server's PHP configuration file to ensure PHP upload is turned on. Mostly, the upload function is turned on by default for any new PHP upload.
    Tweakservers | Professional Server Setup & Security Hardening
    Authorised SmarterTools Reseller, SSL Certificate & TRUSTe Privacy Policy

  3. #3
    Registered User
    Join Date
    Jan 2007
    Posts
    2

    Default

    I had a felling the the PHP config may not have file upload might be truned off, but I can't seem to find the php.ini file on cPanel. I'm not used to cPanel so I have no idea where to look to see the ini file.

  4. #4
    cPanel Product Evangelist Infopro's Avatar
    Join Date
    May 2003
    Location
    Pennsylvania
    Posts
    7,893
    cPanel/Enkompass Access Level

    Root Administrator

    Lightbulb

    /usr/local/lib/php.ini
    Fav cPlinks this week: Blog - cPanel & WHM 11.32 we love it! | cPanel University study for it! | Attracta is coming! we want this!

  5. #5
    Member
    Join Date
    Feb 2006
    Posts
    111

    Default

    Looks as if this guy/girl only has access to Cpanel. You need to contact your host.

Similar Threads & Tags
Similar threads

  1. Replies: 7
    Last Post: 07-01-2008, 07:19 PM
  2. PHP upload images script to CPanel ?
    By darkos32 in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 03-26-2007, 12:18 AM
  3. picture upload html editor failed
    By snaaps in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 03-25-2005, 09:49 PM
  4. mysql databse upload via cpanel
    By ezryder in forum cPanel and WHM Discussions
    Replies: 6
    Last Post: 05-02-2004, 07:23 AM
  5. guestbook picture upload
    By raxafarian in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 11-19-2003, 09:33 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube