Upload picture to cPanel PHP/MySql

milams

Registered
Jan 3, 2007
2
0
151
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:
	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
 

tweakservers

Well-Known Member
Mar 30, 2006
379
0
166
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.
 

milams

Registered
Jan 3, 2007
2
0
151
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.
 

WEB-PROS

Well-Known Member
Feb 19, 2006
110
0
166
Looks as if this guy/girl only has access to Cpanel. You need to contact your host.