?
Solved

How to resolve the upload SIZE limit problem?

Posted on 2012-08-22
13
Medium Priority
?
753 Views
Last Modified: 2012-09-03
Dear EE experts,

We would like to ask for PHP tech support in regarding on how to resolve the upload size limit problem...
Please see the attached embed script for the whole script of our save_upload.php:
<?php
//include("connect.php");
set_time_limit(0);
ini_set("memory_limit","100M");
ini_set('upload_max_filesize', '100M');
extract($_POST); 
		extract($_GET); 

//$objConnect = odbc_connect("uploadDB","","") or die("Database Connect Failed");
	$dbname="dbname"; 
	//$dbhost="xxx.xx.xxx.xxx";
	$dbhost="xxx.xx.xxx.xxx";
	$dbuser="dbuser";
	$dbpass="dbpw";
	


@$Conn=mysql_connect("$dbhost","$dbuser","$dbpass") or die("Not Connect");
mysql_select_db("$dbname",$Conn) or die ('error');

//$objConnect=odbc_connect("stiebelpro","","") or die("Error Connect to Database");
//$objConnect=odbc_connect("uploadDB_ASIA","","") or die("Error Connect to Database");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Save Upload</title><SCRIPT LANGUAGE="JavaScript">

<!-- Begin
// Set up the image files to be used.
var theImages = new Array() // do not change this
// To add more image files, continue with the
// pattern below, adding to the array.

theImages[0] = 'IMG/xg-header-00.jpg'
theImages[1] = 'IMG/xg-header-01.jpg'
theImages[2] = 'IMG/xg-header-02.jpg'
theImages[3] = 'IMG/xg-header-03.jpg'
theImages[4] = 'IMG/IL-header.jpg'

// do not edit anything below this line

var j = 0
var p = theImages.length;
var preBuffer = new Array()
for (i = 0; i < p; i++){
   preBuffer[i] = new Image()
   preBuffer[i].src = theImages[i]
}
var whichImage = Math.round(Math.random()*(p-1));
function showImage(){
document.write('<img src="'+theImages[whichImage]+'">');
}

//  End -->
</script>


</head>
<body>
<?php
$createdate=date("d-m-Y");
$createby="admin";
 $seriesid=$_POST["series"];
//echo "<br>";
$productname=$_POST["productname"];

$strSQL = "INSERT INTO products";
$strSQL .="(seriesid,product_name,updateby,updatedate) ";
$strSQL .="VALUES ";
$strSQL .="('".$_POST["series"]."','".$_POST["productname"]."','".$createby."','".$createdate."')";
$objExec = mysql_query($strSQL) or die (" $strSQL ");
 

 $sql="SELECT * FROM  series WHERE  seriesid=$seriesid ";
$rselect=mysql_query($sql) or die ("Error Execute [".$sql."]");
$rsid=mysql_fetch_array($rselect);
$seriesid=$rsid["seriesid"];
$typeid=$rsid["typeid"];
$cateid=$rsid["categoryid"];
$brandid=$rsid["brandid"];
//echo "<br>";
//odbc_fetch_row($rs);
 $sqltype="SELECT * FROM  producttype  WHERE  typeid=$typeid ";
$stype=mysql_query($sqltype) or die ("Error Execute [".$sqltype."]");
$rtype=mysql_fetch_array($stype);
$pathtype=$rtype["pathtype"];
//echo "<br>";

 $sqlcate="SELECT * FROM  category  WHERE  categoryid=$cateid";
$scate=mysql_query($sqlcate) or die ("Error Execute [".$sqlcate."]");
$rcate=mysql_fetch_array($scate);
$pathcate=$rcate["pathcate"];
//echo "<br>";

 $sqlbrand="SELECT * FROM  brand  WHERE  brandid=$brandid";
$sbrand=mysql_query($sqlbrand) or die ("Error Execute [".$sqlbrand."]");
$rbrand=mysql_fetch_array($sbrand);
$pathbrand=$rbrand["pathbrand"];
//echo "<br>";
$sqlproduct="SELECT * FROM  products  WHERE  seriesid=$seriesid and  product_name='".$productname."'";
$spd=mysql_query($sqlproduct) or die ("Error Execute [".$sqlproduct."]");
$rpd=mysql_fetch_array($spd);
$ID=$rpd["ID"];
//echo "ID=".$ID;

//****************  UPLOAD IMAGE  ***********************
$zip_path="photo/DOWNLOAD/".$pathtype.$pathcate.$pathbrand."/";
$zipm_path="m/photo/DOWNLOAD/".$pathtype.$pathcate.$pathbrand."/";

if($typeid!=7&&$typeid!=8&&$typeid!=10){

//## UPLOAD IMAGE  1 
if(trim($_FILES["small_img"]["tmp_name"])!= ""){
 $imagedownload="photo/DOWNLOAD/".$pathtype.$pathcate.$pathbrand."/".$_FILES["small_img"]["name"];
 $imagedownload_m="m/photo/DOWNLOAD/".$pathtype.$pathcate.$pathbrand."/".$_FILES["small_img"]["name"];
  $downloadpath="DOWNLOAD/".$pathtype.$pathcate.$pathbrand;  
   // Upload Original 
//echo "<br>";
//move_uploaded_file($_FILES["small_img"]["tmp_name"] ,$downloadpath."/".$_FILES["small_img"]["name"]);

$tmp_name = $_FILES["small_img"]["tmp_name"];
$photo_path = "photo/DOWNLOAD/".$pathtype.$pathcate.$pathbrand."/".$_FILES["small_img"]["name"];
$m_path = "m/photo/DOWNLOAD/".$pathtype.$pathcate.$pathbrand."/".$_FILES["small_img"]["name"];

move_uploaded_file($tmp_name,$photo_path);
copy($photo_path,$m_path);

$SQL = "UPDATE  products  SET  download1='".$imagedownload."' WHERE ID=$ID";
$objExec = mysql_query($SQL);

// upload .Zip
   if($_FILES["zipfile"]["name"] != ""){
   
    $type= strrchr($_FILES["zipfile"]["name"],".");
    if($type==".zip"){
	$ZipName = $zip_path.$_FILES["zipfile"]["name"];
	copy($_FILES["zipfile"]["tmp_name"],$ZipName);
	copy($ZipName,$zipm_path.$_FILES["zipfile"]["name"]);
	
	}else{
    $Zip_File=$_FILES["zipfile"]["name"].".zip";
	$ZipName = $zip_path.$Zip_File;
	require_once("dZip.inc.php");
	$zip = new dZip($ZipName); // New Class

	//*** Zip Files ***/
		$zip->addFile($_FILES["zipfile"]["tmp_name"],$_FILES["zipfile"]["name"]); // Source,Destination
		$zip->save();
	  copy($ZipName,$zipm_path.$Zip_File);	
      echo "Zip file complete";
	}	
	$SQL = mysql_query("UPDATE  products  SET  zip1='".$ZipName."'  WHERE ID=$ID");
  }	




  // Upload  Resize 
$uploadpath="photo/PROD-IMG/".$pathtype.$pathcate.$pathbrand; 
$uploadpath_m="m/photo/PROD-IMG/".$pathtype.$pathcate.$pathbrand; 
$images = $_FILES["small_img"]["tmp_name"];
$new_images = "v_".$_FILES["small_img"]["name"];

move_uploaded_file($_FILES["small_img"]["tmp_name"],$uploadpath."/".$_FILES["small_img"]["name"]);
		
		$width=130; //*** Fix Width & Height (Autu caculate) ***//
		$size=GetimageSize($imagedownload);		
		//$height=round($width*$size[1]/$size[0]);
		$height=184;		
		$images_orig = ImageCreateFromJPEG($imagedownload);
		$photoX = ImagesX($images_orig);
		$photoY = ImagesY($images_orig);
		$images_fin = ImageCreateTrueColor($width, $height);
		ImageCopyResampled($images_fin, $images_orig, 0, 0, 0, 0, $width+1, $height+1, $photoX, $photoY);
		ImageJPEG($images_fin,$uploadpath."/".$new_images);
		ImageDestroy($images_orig);
		ImageDestroy($images_fin);
		
		$width=130; //*** Fix Width & Height (Autu caculate) ***//
		$size=GetimageSize($imagedownload_m);		
		//$height=round($width*$size[1]/$size[0]);
		$height=184;		
		$images_orig = ImageCreateFromJPEG($imagedownload_m);
		$photoX = ImagesX($images_orig);
		$photoY = ImagesY($images_orig);
		$images_fin = ImageCreateTrueColor($width, $height);
		ImageCopyResampled($images_fin, $images_orig, 0, 0, 0, 0, $width+1, $height+1, $photoX, $photoY);
		ImageJPEG($images_fin,$uploadpath_m."/".$new_images);
		ImageDestroy($images_orig);
		ImageDestroy($images_fin);

 $imagename="photo/PROD-IMG/".$pathtype.$pathcate.$pathbrand."/".$new_images;
 $SQL = "UPDATE  products  SET  image1='".$imagename."' WHERE ID=$ID";
$objExec = mysql_query($SQL);

echo  "<img src='$imagename' border=0>";
echo  "<br>";
echo  "<img src='$imagedownload' border=0>";
echo  "<br>";
//move_uploaded_file($_FILES["small_img"]["tmp_name"] ,$uploadpath."/".$_FILES["small_img"]["name"]);
}

//## UPLOAD IMAGE  2 
if(trim($_FILES["small_img2"]["tmp_name"])!= ""){
 $imagedownload="photo/DOWNLOAD/".$pathtype.$pathcate.$pathbrand."/".$_FILES["small_img2"]["name"];
  $imagedownload_m="m/photo/DOWNLOAD/".$pathtype.$pathcate.$pathbrand."/".$_FILES["small_img2"]["name"];
  $downloadpath="DOWNLOAD/".$pathtype.$pathcate.$pathbrand;  
   // Upload Original 
//echo "<br>";
//move_uploaded_file($_FILES["small_img2"]["tmp_name"] ,$downloadpath."/".$_FILES["small_img2"]["name"]);

copy($_FILES["small_img2"]["tmp_name"],"photo/DOWNLOAD/".$pathtype.$pathcate.$pathbrand."/".$_FILES["small_img2"]["name"]);
copy($_FILES["small_img2"]["tmp_name"],"m/photo/DOWNLOAD/".$pathtype.$pathcate.$pathbrand."/".$_FILES["small_img2"]["name"]);
 $SQL = "UPDATE  products  SET  download2='".$imagedownload."' WHERE ID=$ID";
$objExec = mysql_query($SQL);

$zip_path="photo/DOWNLOAD/".$pathtype.$pathcate.$pathbrand."/";
$zipm_path="m/photo/DOWNLOAD/".$pathtype.$pathcate.$pathbrand."/";
// upload .Zip
   if($_FILES["zipfile2"]["name"] != ""){
   
    $type= strrchr($_FILES["zipfile2"]["name"],".");
    if($type==".zip"){
	$ZipName2 = $zip_path.$_FILES["zipfile2"]["name"];
	copy($_FILES["zipfile2"]["tmp_name"],$ZipName2);
	copy($ZipName2,$zipm_path.$_FILES["zipfile2"]["name"]);
	
	}else{
    $Zip_File2=$_FILES["zipfile2"]["name"].".zip";
	$ZipName2 = $zip_path.$Zip_File2;
	require_once("dZip.inc.php");
	$zip = new dZip($ZipName2); // New Class

	//*** Zip Files ***/
		$zip->addFile($_FILES["zipfile2"]["tmp_name"],$_FILES["zipfile2"]["name"]); // Source,Destination
		$zip->save();
	  copy($ZipName2,$zipm_path.$Zip_File2);	
      echo "Zip file complete";
	}	
	$SQL = mysql_query("UPDATE  products  SET  zip2='".$ZipName2."'  WHERE ID=$ID");
  }	

  // Upload  Resize
		
 $uploadpath="photo/PROD-IMG/".$pathtype.$pathcate.$pathbrand; 
        $images = $_FILES["small_img2"]["tmp_name"];
		$new_images = "v_".$_FILES["small_img2"]["name"];
		move_uploaded_file($_FILES["small_img2"]["tmp_name"],$uploadpath."/".$_FILES["small_img2"]["name"]);
		$width=130; //*** Fix Width & Heigh (Autu caculate) ***//
		$size=GetimageSize($imagedownload);		
		//$height=round($width*$size[1]/$size[0]);
		$height=160;
		$images_orig = ImageCreateFromJPEG($imagedownload);
		$photoX = ImagesX($images_orig);
		$photoY = ImagesY($images_orig);
		$images_fin = ImageCreateTrueColor($width, $height);
		ImageCopyResampled($images_fin, $images_orig, 0, 0, 0, 0, $width+1, $height+1, $photoX, $photoY);
		ImageJPEG($images_fin,$uploadpath."/".$new_images);
		ImageDestroy($images_orig);
		ImageDestroy($images_fin);
		
		$width=130; //*** Fix Width & Height (Autu caculate) ***//
		$size=GetimageSize($imagedownload_m);		
		//$height=round($width*$size[1]/$size[0]);
		$height=184;		
		$images_orig = ImageCreateFromJPEG($imagedownload_m);
		$photoX = ImagesX($images_orig);
		$photoY = ImagesY($images_orig);
		$images_fin = ImageCreateTrueColor($width, $height);
		ImageCopyResampled($images_fin, $images_orig, 0, 0, 0, 0, $width+1, $height+1, $photoX, $photoY);
		ImageJPEG($images_fin,$uploadpath_m."/".$new_images);
		ImageDestroy($images_orig);
		ImageDestroy($images_fin);

$imagename="photo/PROD-IMG/".$pathtype.$pathcate.$pathbrand."/".$new_images;
 $SQL = "UPDATE  products  SET  image2='".$imagename."' WHERE ID=$ID";
$objExec = mysql_query($SQL);

echo  "<img src='$imagename' border=0>";
echo  "<br><br>";
echo  "<img src='$imagedownload' border=0>";
echo  "<br>";
//move_uploaded_file($_FILES["small_img"]["tmp_name"] ,$uploadpath."/".$_FILES["small_img"]["name"]);
}
//## UPLOAD IMAGE  3
if(trim($_FILES["small_img3"]["tmp_name"])!= ""){
 $imagedownload="photo/DOWNLOAD/".$pathtype.$pathcate.$pathbrand."/".$_FILES["small_img3"]["name"];
 $imagedownload_m="m/photo/DOWNLOAD/".$pathtype.$pathcate.$pathbrand."/".$_FILES["small_img3"]["name"];
  $downloadpath="DOWNLOAD/".$pathtype.$pathcate.$pathbrand;  
   // Upload Original 
//echo "<br>";
//move_uploaded_file($_FILES["small_img3"]["tmp_name"] ,$downloadpath."/".$_FILES["small_img3"]["name"]);


copy($_FILES["small_img3"]["tmp_name"],"photo/DOWNLOAD/".$pathtype.$pathcate.$pathbrand."/".$_FILES["small_img3"]["name"]);
copy($_FILES["small_img3"]["tmp_name"],"m/photo/DOWNLOAD/".$pathtype.$pathcate.$pathbrand."/".$_FILES["small_img3"]["name"]);
 $SQL = "UPDATE  products  SET  download3='".$imagedownload."' WHERE ID=$ID";
$objExec = mysql_query($SQL);

// upload .Zip
$zip_path="photo/DOWNLOAD/".$pathtype.$pathcate.$pathbrand."/";
$zipm_path="m/photo/DOWNLOAD/".$pathtype.$pathcate.$pathbrand."/";
   if($_FILES["zipfile3"]["name"] != ""){
   
    $type= strrchr($_FILES["zipfile3"]["name"],".");
    if($type==".zip"){
	$ZipName3 = $zip_path.$_FILES["zipfile3"]["name"];
	copy($_FILES["zipfile3"]["tmp_name"],$ZipName3);
	copy($ZipName3,$zipm_path.$_FILES["zipfile2"]["name"]);
	
	}else{
    $Zip_File3=$_FILES["zipfile3"]["name"].".zip";
	$ZipName3 = $zip_path.$Zip_File3;
	require_once("dZip.inc.php");
	$zip = new dZip($ZipName3); // New Class

	//*** Zip Files ***/
		$zip->addFile($_FILES["zipfile3"]["tmp_name"],$_FILES["zipfile3"]["name"]); // Source,Destination
		$zip->save();
	  copy($ZipName3,$zipm_path.$Zip_File3);	
      echo "Zip file complete";
	}	
	$SQL = mysql_query("UPDATE  products  SET  zip3='".$ZipName3."'  WHERE ID=$ID");
  }	

  // Upload  Resize 
 $uploadpath="photo/PROD-IMG/".$pathtype.$pathcate.$pathbrand; 
        $images = $_FILES["small_img3"]["tmp_name"];
		$new_images = "v_".$_FILES["small_img3"]["name"];
		move_uploaded_file($_FILES["small_img3"]["tmp_name"],$uploadpath."/".$_FILES["small_img3"]["name"]);
		$width=130; //*** Fix Width & Heigh (Autu caculate) ***//
		$size=GetimageSize($imagedownload);		
		//$height=round($width*$size[1]/$size[0]);
		$height=160;
		$images_orig = ImageCreateFromJPEG($imagedownload);
		$photoX = ImagesX($images_orig);
		$photoY = ImagesY($images_orig);
		$images_fin = ImageCreateTrueColor($width, $height);
		ImageCopyResampled($images_fin, $images_orig, 0, 0, 0, 0, $width+1, $height+1, $photoX, $photoY);
		ImageJPEG($images_fin,$uploadpath."/".$new_images);
		ImageDestroy($images_orig);
		ImageDestroy($images_fin);
		
		$width=130; //*** Fix Width & Height (Autu caculate) ***//
		$size=GetimageSize($imagedownload_m);		
		//$height=round($width*$size[1]/$size[0]);
		$height=184;		
		$images_orig = ImageCreateFromJPEG($imagedownload_m);
		$photoX = ImagesX($images_orig);
		$photoY = ImagesY($images_orig);
		$images_fin = ImageCreateTrueColor($width, $height);
		ImageCopyResampled($images_fin, $images_orig, 0, 0, 0, 0, $width+1, $height+1, $photoX, $photoY);
		ImageJPEG($images_fin,$uploadpath_m."/".$new_images);
		ImageDestroy($images_orig);
		ImageDestroy($images_fin);

$imagename="photo/PROD-IMG/".$pathtype.$pathcate.$pathbrand."/".$new_images;
$SQL = "UPDATE  products  SET  image3='".$imagename."' WHERE ID=$ID";
$objExec = mysql_query($SQL);

echo  "<img src='$imagename' border=0>";
echo  "<br><br>";
echo  "<img src='$imagedownload' border=0>";
echo  "<br>";
//move_uploaded_file($_FILES["small_img"]["tmp_name"] ,$uploadpath."/".$_FILES["small_img"]["name"]);
}
//## UPLOAD IMAGE  4
if(trim($_FILES["small_img4"]["tmp_name"])!= ""){
 $imagedownload="photo/DOWNLOAD/".$pathtype.$pathcate.$pathbrand."/".$_FILES["small_img4"]["name"];
 $imagedownload_m="m/photo/DOWNLOAD/".$pathtype.$pathcate.$pathbrand."/".$_FILES["small_img4"]["name"];
  $downloadpath="DOWNLOAD/".$pathtype.$pathcate.$pathbrand;  
   // Upload Original 
//echo "<br>";
//move_uploaded_file($_FILES["small_img4"]["tmp_name"] ,$downloadpath."/".$_FILES["small_img4"]["name"]);

copy($_FILES["small_img4"]["tmp_name"],"photo/DOWNLOAD/".$pathtype.$pathcate.$pathbrand."/".$_FILES["small_img4"]["name"]);
copy($_FILES["small_img4"]["tmp_name"],"m/photo/DOWNLOAD/".$pathtype.$pathcate.$pathbrand."/".$_FILES["small_img4"]["name"]);

 $SQL = "UPDATE  products  SET  download4='".$imagedownload."' WHERE ID=$ID";
$objExec = mysql_query($SQL);

// upload .Zip
$zip_path="photo/DOWNLOAD/".$pathtype.$pathcate.$pathbrand."/";
$zipm_path="m/photo/DOWNLOAD/".$pathtype.$pathcate.$pathbrand."/";
   if($_FILES["zipfile4"]["name"] != ""){
   
    $type= strrchr($_FILES["zipfile4"]["name"],".");
    if($type==".zip"){
	$ZipName4 = $zip_path.$_FILES["zipfile4"]["name"];
	copy($_FILES["zipfile4"]["tmp_name"],$ZipName4);
	copy($ZipName4,$zipm_path.$_FILES["zipfile4"]["name"]);
	
	}else{
    $Zip_File4=$_FILES["zipfile4"]["name"].".zip";
	$ZipName4 = $zip_path.$Zip_File4;
	require_once("dZip.inc.php");
	$zip = new dZip($ZipName4); // New Class

	//*** Zip Files ***/
		$zip->addFile($_FILES["zipfile4"]["tmp_name"],$_FILES["zipfile4"]["name"]); // Source,Destination
		$zip->save();
	  copy($ZipName4,$zipm_path.$Zip_File4);	
      echo "Zip file complete";
	}	
	$SQL = mysql_query("UPDATE  products  SET  zip4='".$ZipName4."'  WHERE ID=$ID");
  }	

  // Upload  Resize 
 $uploadpath="photo/PROD-IMG/".$pathtype.$pathcate.$pathbrand; 
        $images = $_FILES["small_img4"]["tmp_name"];
		$new_images = "v_".$_FILES["small_img4"]["name"];
		move_uploaded_file($_FILES["small_img4"]["tmp_name"],$uploadpath."/".$_FILES["small_img4"]["name"]);
		$width=130; //*** Fix Width & Heigh (Autu caculate) ***//
		$size=GetimageSize($imagedownload);		
		//$height=round($width*$size[1]/$size[0]);
		$height=160;		
		$images_orig = ImageCreateFromJPEG($imagedownload);
		$photoX = ImagesX($images_orig);
		$photoY = ImagesY($images_orig);
		$images_fin = ImageCreateTrueColor($width, $height);
		ImageCopyResampled($images_fin, $images_orig, 0, 0, 0, 0, $width+1, $height+1, $photoX, $photoY);
		ImageJPEG($images_fin,$uploadpath."/".$new_images);
		ImageDestroy($images_orig);
		ImageDestroy($images_fin);
		
		$width=130; //*** Fix Width & Height (Autu caculate) ***//
		$size=GetimageSize($imagedownload_m);		
		//$height=round($width*$size[1]/$size[0]);
		$height=184;		
		$images_orig = ImageCreateFromJPEG($imagedownload_m);
		$photoX = ImagesX($images_orig);
		$photoY = ImagesY($images_orig);
		$images_fin = ImageCreateTrueColor($width, $height);
		ImageCopyResampled($images_fin, $images_orig, 0, 0, 0, 0, $width+1, $height+1, $photoX, $photoY);
		ImageJPEG($images_fin,$uploadpath_m."/".$new_images);
		ImageDestroy($images_orig);
		ImageDestroy($images_fin);

$imagename="photo/PROD-IMG/".$pathtype.$pathcate.$pathbrand."/".$new_images;
$SQL = "UPDATE  products  SET  image4='".$imagename."' WHERE ID=$ID";
$objExec = mysql_query($SQL);

echo  "<img src='$imagename' border=0>";
echo  "<br><br>";
echo  "<img src='$imagedownload' border=0>";
//move_uploaded_file($_FILES["small_img"]["tmp_name"] ,$uploadpath."/".$_FILES["small_img"]["name"]);
}
//## UPLOAD IMAGE  5
if(trim($_FILES["small_img5"]["tmp_name"])!= ""){
 $imagedownload="photo/DOWNLOAD/".$pathtype.$pathcate.$pathbrand."/".$_FILES["small_img5"]["name"];
 $imagedownload_m="m/photo/DOWNLOAD/".$pathtype.$pathcate.$pathbrand."/".$_FILES["small_img5"]["name"];
  $downloadpath="DOWNLOAD/".$pathtype.$pathcate.$pathbrand;  
   // Upload Original 
//move_uploaded_file($_FILES["small_img5"]["tmp_name"] ,$downloadpath."/".$_FILES["small_img5"]["name"]);

copy($_FILES["small_img5"]["tmp_name"],"photo/DOWNLOAD/".$pathtype.$pathcate.$pathbrand."/".$_FILES["small_img5"]["name"]);
copy($_FILES["small_img5"]["tmp_name"],"m/photo/DOWNLOAD/".$pathtype.$pathcate.$pathbrand."/".$_FILES["small_img5"]["name"]);
 $SQL = "UPDATE  products  SET  download5='".$imagedownload."' WHERE ID=$ID";
$objExec = mysql_query($SQL);

// upload .Zip
$zip_path="photo/DOWNLOAD/".$pathtype.$pathcate.$pathbrand."/";
$zipm_path="m/photo/DOWNLOAD/".$pathtype.$pathcate.$pathbrand."/";

   if($_FILES["zipfile5"]["name"] != ""){
   
    $type= strrchr($_FILES["zipfile5"]["name"],".");
    if($type==".zip"){
	$ZipName5 = $zip_path.$_FILES["zipfile5"]["name"];
	copy($_FILES["zipfile5"]["tmp_name"],$ZipName2);
	copy($ZipName5,$zipm_path.$_FILES["zipfile5"]["name"]);
	
	}else{
    $Zip_File5=$_FILES["zipfile5"]["name"].".zip";
	$ZipName5 = $zip_path.$Zip_File5;
	require_once("dZip.inc.php");
	$zip = new dZip($ZipName5); // New Class

	//*** Zip Files ***/
		$zip->addFile($_FILES["zipfile5"]["tmp_name"],$_FILES["zipfile5"]["name"]); // Source,Destination
		$zip->save();
	  copy($ZipName5,$zipm_path.$Zip_File5);	
      echo "Zip file complete";
	}	
	$SQL = mysql_query("UPDATE  products  SET  zip5='".$ZipName5."'  WHERE ID=$ID");
  }	

  // Upload  Resize 
 $uploadpath="photo/PROD-IMG/".$pathtype.$pathcate.$pathbrand; 
        $images = $_FILES["small_img5"]["tmp_name"];
		$new_images = "v_".$_FILES["small_img5"]["name"];
		move_uploaded_file($_FILES["small_img5"]["tmp_name"],$uploadpath."/".$_FILES["small_img5"]["name"]);
		$width=130; //*** Fix Width & Heigh (Autu caculate) ***//
		$size=GetimageSize($imagedownload);		
		//$height=round($width*$size[1]/$size[0]);
		$height=160;		
		$images_orig = ImageCreateFromJPEG($imagedownload);
		$photoX = ImagesX($images_orig);
		$photoY = ImagesY($images_orig);
		$images_fin = ImageCreateTrueColor($width, $height);
		ImageCopyResampled($images_fin, $images_orig, 0, 0, 0, 0, $width+1, $height+1, $photoX, $photoY);
		ImageJPEG($images_fin,$uploadpath."/".$new_images);
		ImageDestroy($images_orig);
		ImageDestroy($images_fin);
		
		$width=130; //*** Fix Width & Height (Autu caculate) ***//
		$size=GetimageSize($imagedownload_m);		
		//$height=round($width*$size[1]/$size[0]);
		$height=184;		
		$images_orig = ImageCreateFromJPEG($imagedownload_m);
		$photoX = ImagesX($images_orig);
		$photoY = ImagesY($images_orig);
		$images_fin = ImageCreateTrueColor($width, $height);
		ImageCopyResampled($images_fin, $images_orig, 0, 0, 0, 0, $width+1, $height+1, $photoX, $photoY);
		ImageJPEG($images_fin,$uploadpath_m."/".$new_images);
		ImageDestroy($images_orig);
		ImageDestroy($images_fin);

$imagename="photo/PROD-IMG/".$pathtype.$pathcate.$pathbrand."/".$new_images;
 $SQL = "UPDATE  products  SET  image5='".$imagename."' WHERE ID=$ID";
$objExec = mysql_query($SQL);

//echo  "<img src=$imagename border=0>";
//echo  "<br><br>";
//echo  "<img src=$imagedownload border=0>";
//move_uploaded_file($_FILES["small_img"]["tmp_name"] ,$uploadpath."/".$_FILES["small_img"]["name"]);
}

}elseif($typeid==7||$typeid==8||$typeid==10){

//****************  UPLOAD PDF  **************************
if(trim($_FILES["imagefile"]["tmp_name"])!= ""){

// Upload  Resize 
 $uploadpath="photo/PROD-IMG/".$pathtype.$pathcate.$pathbrand; 
        $images = $_FILES["imagefile"]["tmp_name"];
		$new_images = "v_".$_FILES["imagefile"]["name"];
		move_uploaded_file($_FILES["imagefile"]["tmp_name"] ,"tempresize/".$_FILES["imagefile"]["name"]);

$tempimg="tempresize/".$_FILES["imagefile"]["name"];
		$width=300; //*** Fix Width & Heigh (Autu caculate) ***//
		$size=GetimageSize($tempimg);		
		//$height=round($width*$size[1]/$size[0]);
		$height=400;		
		$images_orig = ImageCreateFromJPEG($tempimg);
		$photoX = ImagesX($images_orig);
		$photoY = ImagesY($images_orig);
		$images_fin = ImageCreateTrueColor($width, $height);
		ImageCopyResampled($images_fin, $images_orig, 0, 0, 0, 0, $width+1, $height+1, $photoX, $photoY);
		ImageJPEG($images_fin,$uploadpath."/".$new_images);
		ImageDestroy($images_orig);
		ImageDestroy($images_fin);

$imagename="photo/PROD-IMG/".$pathtype.$pathcate.$pathbrand."/".$new_images;
 $SQL = "UPDATE  products  SET  image1='".$imagename."' WHERE ID=$ID";
$objExec = mysql_query($SQL);

//echo  "<img src=$imagename border=0>";
//echo  "<br><br>";
//echo  "<img src=$imagedownload border=0>";
//move_uploaded_file($_FILES["small_img"]["tmp_name"] ,$uploadpath."/".$_FILES["small_img"]["name"]);

}

if(trim($_FILES["file_pdf"]["tmp_name"])!= ""){
$pdfUpload=trim($_FILES["file_pdf"]["tmp_name"]);
$file=$_FILES["file_pdf"]["name"];
$type= strrchr($file,"."); 
//echo "<br> type= ".$type."<br>";
if($type==".pdf"){
  $pdffile="PDF/".$pathtype.$pathcate.$pathbrand."/".$_FILES["file_pdf"]["name"];
 $uploadpath="PDF/".$pathtype.$pathcate.$pathbrand;

move_uploaded_file($_FILES["file_pdf"]["tmp_name"] ,$uploadpath."/".$_FILES["file_pdf"]["name"]);

//move_uploaded_file($_FILES["file_pdf"]["tmp_name"],"../pdf/Product Pictures/Shower Unit/STE/".$_FILES["file_pdf"]["name"]);

 $SQL = "UPDATE  products  SET  product_file='".$pdffile."' WHERE ID=$ID ";
$objExec = mysql_query($SQL);
} else{ 

echo "<script language=javascript>alert('Upload  PDF File (*.pdf)');</script>";
echo "<meta http-equiv=\"refresh\" content=\"0;URL=upload.php\"> ";exit();
  }

}

} // end 
echo  "<br><br>";
echo "Save Done.";
//odbc_close($objConnect);
?>

<a href="upload.php">Back</a>
<!--<meta http-equiv=\"refresh\" content=\"1;URL=upload_products.php\"> -->
</body>
</html>

Open in new window

the problem is, if we're uploading files and the file size would be around 10MB or more, it would give us an error result. however, if we'll just upload files with size less than 10MB, around 6MB is fine, uploading files with less than 10MB is fine.
It take long time in uploading and error in result. Sometimes this is the error result that we receive: Error Execute [SELECT * FROM series WHERE seriesid= ]

You may try it here: http://www.cssasia.info/ste/upload.php
Select the Product Pictures --> AQ Series --> then put any title as you want.
Please choose any image, but with ZIP file, make it big size, around 10MB or more, then click Submit...

Kindly advise which part/line are we having problem, to resolve this issue...

Thank you in advance and hope to hear soon...
0
Comment
Question by:Stiebel Eltron
12 Comments
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 38319916
Wow... More than 500 lines of code!  I doubt if I can debug anything that big, but I can show you a teaching example of how to upload files.  It has comments that may be helpful.  See the part about "large files."

<?php // RAY_upload_example.php
error_reporting(E_ALL);


// MANUAL REFERENCE PAGES YOU MUST UNDERSTAND TO UPLOAD FILES
// http://php.net/manual/en/features.file-upload.php
// http://php.net/manual/en/features.file-upload.common-pitfalls.php
// http://php.net/manual/en/function.move-uploaded-file.php
// http://php.net/manual/en/reserved.variables.files.php

// MANUAL PAGES THAT ARE IMPORTANT IF YOU ARE DEALING WITH LARGE FILES
// http://php.net/manual/en/ini.core.php#ini.upload-max-filesize
// http://php.net/manual/en/ini.core.php#ini.post-max-size
// http://php.net/manual/en/info.configuration.php#ini.max-input-time


// PHP 5.1+  SEE http://php.net/manual/en/function.date-default-timezone-set.php
date_default_timezone_set('America/Chicago');

// ESTABLISH THE NAME OF THE 'uploads' DIRECTORY (MUST ALREADY EXIST)
$uploads = 'RAY_junk';

// ESTABLISH THE BIGGEST FILE SIZE WE CAN ACCEPT - ABOUT 8 MB
$max_file_size = '8000000';

// ESTABLISH THE MAXIMUM NUMBER OF FILES WE CAN UPLOAD
$nf = 3;

// ESTABLISH THE KINDS OF FILE EXTENSIONS WE CAN ACCEPT
$file_exts = array
( 'jpg'
, 'gif'
, 'png'
, 'txt'
, 'pdf'
, 'mp3'
)
;

// LIST OF THE ERRORS THAT MAY BE REPORTED IN $_FILES[]["error"] (THERE IS NO #5)
$errors = array
( 0 => "Success!"
, 1 => "The uploaded file exceeds the upload_max_filesize directive in php.ini"
, 2 => "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form"
, 3 => "The uploaded file was only partially uploaded"
, 4 => "No file was uploaded"
, 5 => "UNDEFINED ERROR"
, 6 => "Missing a temporary folder"
, 7 => "Cannot write file to disk"
)
;




// IF THERE IS NOTHING IN $_POST, PUT UP THE FORM FOR INPUT
if (empty($_POST))
{
    ?>
    <h2>Upload <?php echo $nf; ?> file(s)</h2>

    <!--
        SOME THINGS TO NOTE ABOUT THIS FORM...
        ENCTYPE IN THE HTML <FORM> STATEMENT
        MAX_FILE_SIZE MUST PRECEDE THE FILE INPUT FIELD
        INPUT NAME= IN TYPE=FILE DETERMINES THE NAME YOU FIND IN $_FILES ARRAY
        ABSENCE OF ACTION= ATTRIBUTE IN FORM TAG CAUSES POST TO SAME URL
    -->

    <form name="UploadForm" enctype="multipart/form-data" method="post">
    <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $max_file_size; ?>" />
    <p>
    Find the file(s) you want to upload and click the "Upload" button below.
    </p>

    <?php // CREATE INPUT STATEMENTS FOR UP TO $n FILE NAMES
    for ($n = 0; $n < $nf; $n++)
    {
        echo "<input name=\"userfile$n\" type=\"file\" size=\"80\" /><br/>\n";
    }
    ?>

    <br/>Check this box <input autocomplete="off" type="checkbox" name="overwrite" /> to <strong>overwrite</strong> existing files.
    <input type="submit" value="Upload" />
    </form>
    <?php
    die();
}
// END OF THE FORM SCRIPT



// WE HAVE GOT SOMETHING IN $_POST - RUN THE ACTION SCRIPT
else
{
    // THERE IS POST DATA - PROCESS IT
    echo "<h2>Results: File Upload</h2>\n";

    // ACTIVATE THIS TO SEE WHAT IS COMING THROUGH
    // echo "<pre>"; var_dump($_FILES); var_dump($_POST); echo "</pre>\n";

    // ITERATE OVER THE CONTENTS OF $_FILES
    foreach ($_FILES as $my_uploaded_file)
    {
        // SKIP OVER EMPTY SPOTS - NOTHING UPLOADED
        $error_code = $my_uploaded_file["error"];
        if ($error_code == 4) continue;

        // SYNTHESIZE THE NEW FILE NAME
        $f_type    = trim(strtolower(end    (explode( '.', basename($my_uploaded_file['name'] )))));
        $f_name    = trim(strtolower(current(explode( '.', basename($my_uploaded_file['name'] )))));
        $my_new_file
        = getcwd()
        . DIRECTORY_SEPARATOR
        . $uploads
        . DIRECTORY_SEPARATOR
        . $f_name
        . '.'
        . $f_type
        ;
        $my_file
        = $uploads
        . DIRECTORY_SEPARATOR
        . $f_name
        . '.'
        . $f_type;

        // OPTIONAL TEST FOR ALLOWABLE EXTENSIONS
        if (!in_array($f_type, $file_exts)) die("Sorry, $f_type files not allowed");

        // IF THERE ARE ERRORS
        if ($error_code != 0)
        {
            $error_message = $errors[$error_code];
            die("Sorry, Upload Error Code: $error_code: $error_message");
        }

        // GET THE FILE SIZE
        $file_size = number_format($my_uploaded_file["size"]);

        // IF THE FILE IS NEW (DOES NOT EXIST)
        if (!file_exists($my_new_file))
        {
            // IF THE MOVE FUNCTION WORKED CORRECTLY
            if (move_uploaded_file($my_uploaded_file['tmp_name'], $my_new_file))
            {
                $upload_success = 1;
            }
            // IF THE MOVE FUNCTION FAILED
            else
            {
                $upload_success = -1;
            }
        }

        // IF THE FILE ALREADY EXISTS
        else
        {
            echo "<br/><b><i>$my_file</i></b> already exists.\n";

            // SHOULD WE OVERWRITE THE FILE? IF NOT
            if (empty($_POST["overwrite"]))
            {
                $upload_success = 0;
            }
            // IF WE SHOULD OVERWRITE THE FILE, TRY TO MAKE A BACKUP
            else
            {
                $now    = date('Y-m-d');
                $my_bak = $my_new_file . '.' . $now . '.bak';
                if (!copy($my_new_file, $my_bak))
                {
                    echo "<br/><strong>Attempted Backup Failed!</strong>\n";
                }
                if (move_uploaded_file($my_uploaded_file['tmp_name'], $my_new_file))
                {
                    $upload_success = 2;
                }
                else
                {
                    $upload_success = -1;
                }
            }
        }

        // REPORT OUR SUCCESS OR FAILURE
        if ($upload_success == 2) { echo "<br/>It has been overwritten.\n"; }
        if ($upload_success == 1) { echo "<br/><strong>$my_file</strong> has been saved.\n"; }
        if ($upload_success == 0) { echo "<br/><strong>It was NOT overwritten.</strong>\n"; }
        if ($upload_success < 0)  { echo "<br/><strong>ERROR: $my_file NOT SAVED - SEE WARNING FROM move_uploaded_file() COMMAND</strong>\n"; }
        if ($upload_success > 0)
        {
            echo "$file_size bytes uploaded.\n";
            if (!chmod ($my_new_file, 0755))
            {
                echo "<br/>chmod(0755) FAILED: fileperms() = ";
                echo substr(sprintf('%o', fileperms($my_new_file)), -4);
            }
            echo "<br/><a target=\"_blank\" href=\"$my_file\">See the file $my_file</a>\n";
        }
    // END FOREACH ITERATOR - EACH ITERATION PROCESSES ONE FILE
    }
}

Open in new window

HTH, ~Ray
0
 
LVL 35

Expert Comment

by:gr8gonzo
ID: 38320071
Try editing your php.ini file and changing post_max_size and upload_max_filesize to 15M:

post_max_size = 15M
upload_max_filesize = 15M

Then restart your web server, refresh the upload page, and try to upload an 11-megabyte file and see if that works any better.

I have my reservations about this, since you said that sometimes you get a database query showing up in the results, so it sounds almost like something else is a factor in the problem, but at the very least, make sure that you're not simply hitting a limit enforced by the default php.ini file.
0
 

Author Comment

by:Stiebel Eltron
ID: 38323618
@Ray_Paseur, we'll check on that, and will try to apply with our upload application...

@gr8gonzo, if only we can edit that PHP.INI file, we'll not have that problem, but the problem is, godaddy tech support is the BEST TECH SUPPORT IN THE WORLD! (Opposite!).
They CAN'T SUPPORT us edit that file (php.ini) and/or support regarding web.config file.
They can only support a very simple tech problem...
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 

Author Comment

by:Stiebel Eltron
ID: 38324021
@Ray_Paseur, in regards to the script that you sent to us, could you please advise for its ACTION script? As we couldn't find it's action page, that's the form page only, right?
But we would like to see whether you have ACTION page for that...

Thank you and hope to hear soon...

:)
0
 
LVL 35

Accepted Solution

by:
gr8gonzo earned 2000 total points
ID: 38325015
Ah, so you're on a shared hosting system with GoDaddy. I'm sorry to hear that - I'm not a fan of their services. Still, follow these guides:

Modifying the php.ini (actually, probably php5.ini) in your shared hosting account:
http://roberto-montero.com/blog/how-tweak-you-phpini-godaddycom

How to reset the server to make the ini file changes take effect right away
http://support.godaddy.com/help/article/5647/why-isnt-my-phpini-file-taking-effect
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 38333696
On IIS7, the default upload limit for IIS is 30,000,000 bytes.  Godaddy tech support said that they haven't changed it (as far as he could tell).  You can set your PHP limit to that in 'php.ini'.
0
 

Author Comment

by:Stiebel Eltron
ID: 38335496
@gr8gonzo: we regret to subscribe on that server and we couldn't cancel it as we just registered early last year. the contract will expire on 2014. So, still long way to work with GoDaddy poor services... but will check your advise from the link that you shared. Thank you!

@DaveBaldwin: We'll go and check this php5.ini (as with the latest IIS, it's not php.ini, but php5.ini)... thank you!

hope to solve this issue asap, as this is the only pending that we're facing...
0
 

Author Comment

by:Stiebel Eltron
ID: 38335975
We followed this
To Recycle the Application Pool on Windows Shared Hosting Accounts
- Log in to your Account Manager.
- Click Web Hosting.
- Next to the hosting account you want to use, click Launch.
- In the Tools section of the Hosting Control Center, click the IIS Management icon.
- Click Recycle App Pool and follow any prompts.
- Reload the phpinfo.php page to see if the desired changes have taken effect.

NOTE: We recommend removing the phpinfo.php file from your hosting account when you are finished testing.

from the second link that gr8gonzo advised, but we couldn't find the phpinfo.php that was said to be removed...

Please advise where can we find it?
0
 

Author Comment

by:Stiebel Eltron
ID: 38354166
I've requested that this question be deleted for the following reason:

Will revise the question and open a new thread...
0
 
LVL 35

Expert Comment

by:gr8gonzo
ID: 38354167
The phpinfo.php is a file that you create. Look at the yellow box above "Linux Shared Hosting".

The file is just something that displays the current settings, so you can easily see whether PHP has accepted the changes. So the instructions were just suggesting that you create that file, then after you reload the server, that you check it to look for the updates, and then delete it.

Also, why are you closing this question? It seems we're on the right path already and this is all information that could help someone else...
0
 

Author Comment

by:Stiebel Eltron
ID: 38362192
@gr8gonzo: We're deleting this question because we revised the subject, changed to "How to revise the attached PHP5.INI in order to fix the upload problem?" (http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/Q_27849128.html)

Thank you!
0
 
LVL 35

Expert Comment

by:gr8gonzo
ID: 38362206
@stiebel
That is a different question, though. The original question was the diagnosis of the cause and resolution of the issue. If the answer of how to change the max upload size is to change the INI file, then that is the answer to this question, and that is how it should be closed.

If it spawns another question, then that is completely fine - that just means there is another question to answer.

I try to discourage people from deleting questions mostly because there will be another person who has this same problem and will find your question and say, "That is exactly the problem I'm experiencing!" and they can then follow the conversation all the way to the answer or to the next question (and when you accept an answer, you're helping identify the correct path to the solution for someone else).

If you revise and delete, then you're cutting off that initial path that leads them to the next question.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
It’s a season to be thankful, and we’re thankful for users like you who engage on site, solve technology problems, and network with others in the industry. What tech are we most thankful for? Keep reading.
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses
Course of the Month13 days, 18 hours left to enroll

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question