Jump to content

Recommended Posts

Hey guys does anyone know why this doesnt upload large files? 6/7mb... the PHP ini files seem fine... i even overdone it by 

upload_max_filesize = 20M;

post_max_size = 20M;
max_execution_time = 400;
max_input_time = 400;
memory_limit = 900M;
 
was over the top but was just trying to find answer... i have the code here and attaching a full code thing.
 
	$src1 = '../../image_uploads/layout_uploads/temp/temp/'.$image_name.'.jpg';
			$src2 = '../../image_uploads/layout_uploads/temp/'.$image_name.'.jpg';

			// Get Rid Of Old Files
			unlink($src1);
			if(!empty($src2)){
				unlink($src2);
			}
			
			move_uploaded_file($_FILES["img_upload"]["tmp_name"], $src1);
			
			// INIT
			list($old_width, $old_height) = getimagesize($src1);
			
			if($old_width > $old_height){
				$total_w = $old_width;
				$total_h = $old_width;
				$image_top1 = $total_h - $old_height;
				$image_top2 = $image_top1 * 0.5;
				$image_top = $image_top2;
				$image_left = 0;
			} else {
				$total_w = $old_height;
				$total_h = $old_height;
				$image_left1 = $total_w - $old_width;
				$image_left2 = $image_left1 * 0.5;
				$image_top = 0;
				$image_left = $image_left2;
			}
			
			$create_bg = imagecreatetruecolor($total_w,$total_h); // Full Blue
			
			// CREATE WHITE BG
			$white = imagecolorallocate($create_bg, 255, 255, 255);
			imagefilledrectangle($create_bg, 0, 0, $total_h, $total_w, $white);
			
			// GET IMAGE
			$create_image = imagecreatefromjpeg($src1);
			
			// CREATE IMAGE
			imagecopyresampled($create_bg, $create_image, $image_left, $image_top, 0, 0, $old_width, $old_height, $old_width, $old_height);

			// OUTPUT
			if(filesize($src1) > 2000000){
				imagejpeg($create_bg, $src2, 60);
			} else if(filesize($src1) < 2000000 && filesize($src1) > 1000000){
				imagejpeg($create_bg, $src2, 70);
			} else if(filesize($src1) < 1000000 && filesize($src1) > 100000){
				imagejpeg($create_bg, $src2, 80);
			} else if(filesize($src1) < 100000 && filesize($src1) > 50000){
				imagejpeg($create_bg, $src2, 90);
			} else {
				imagejpeg($create_bg, $src2, 95);
			}
			
			unlink($src1);

 

Link to comment
https://forums.phpfreaks.com/topic/282112-php-file-upload/
Share on other sites

are you sure the file isn't being upload or is it just not being resized?

 

your code has no error checking logic in it to get it (your code) to tell you if, when, or where any part of it is failing.

 

also, do you have php's error_reporting set to E_ALL and display_errors to ON (or log_errors to ON), to get php to report and display (or log) any errors it detects?

Link to comment
https://forums.phpfreaks.com/topic/282112-php-file-upload/#findComment-1449365
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.