Jump to content

Recommended Posts

Hey Everyone,

 

I'm having a problem with this image upload script since I upgraded Apache. I noticed in my .htaccess files it no longer let me set maxupload size and it blanks it out saying it is now controlled by the .ini file.

 

This script worked fine till the upgrades.

 

The error I get is for files over 309 KB.

 

Below is the script... I've blanked out alot that wasn't related to this issue.. also.. The error i'm getting is..

Warning: imagejpeg() [function.imagejpeg]: Unable to open 'tmp/Sean-101_6538.JPG' for writing: Permission denied in /home/myvibe/public_html/user/imageuploader.php on line 46

 

<?
1 	include("../assets/includes/header.php"); ?>
2
3  <div id="main">
4  <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td width="73%" height="281" valign="top" bgcolor="#FFFFFF"><div align="left"><span style="font-weight: bold"> </span>
        <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td valign="top">
	<img src="*****" width="556" height="55" /><br />
	<table width="100%" border="0" cellspacing="5" cellpadding="5">
          <tr>
            <td height="241" valign="top">
		<?php
ini_set("memory_limit","50M");
if(isset($_POST['Submit']))

{
          if($_FILES['image']['type'] == 'image/pjpeg' || $_FILES['image']['type'] == 'image/gif'){
	   $size = 90; // the thumbnail width		   
           $maxfile = '200000'; //maximum file size to upload
           $mode = '0666';
           $userfile_name = $_FILES['image']['name'];
           $userfile_tmp = $_FILES['image']['tmp_name'];
           $userfile_size = $_FILES['image']['size'];
           $userfile_type = $_FILES['image']['type'];
           if (isset($_FILES['image']['name'])) 
           {
               $prod_img = "tmp/".$_SESSION['onlineuser']."-original".$_FILES['image']['name'];
               $prod_img_thumb = "tmp/".$_SESSION['onlineuser']."-".$_FILES['image']['name'];
		                move_uploaded_file($userfile_tmp, $prod_img);
               chmod ($prod_img, octdec($mode));
               $sizes = getimagesize($prod_img);
               $aspect_ratio = $sizes[1]/$sizes[0]; 
               if ($sizes[0] <= $size)
              {
                  $new_width = $sizes[0];
                  $new_height = $sizes[1];
               }else{
                   $new_height = $size;
                   $new_width = abs($new_height/$aspect_ratio);
42               }
43               $destimg=imagecreatetruecolor($new_width,$new_height) or die('Problem In Creating image');
44               $srcimg=ImageCreateFromJPEG($prod_img) or die('Problem In opening Source Image');
45               ImageCopyResampled($destimg, $srcimg, 0, 0, 0, 0, $new_width, $new_height, $sizes[0], $sizes[1]) or die('Problem In resampling');
46             ImageJPEG($destimg,$prod_img_thumb,90) or die('Problem In saving');

               imagedestroy($destimg);
           }
	   

	//Update User Account

Link to comment
https://forums.phpfreaks.com/topic/55038-image-upload-failing-large-file-size/
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.