[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

4.4

PHP GD image upload failing

Asked by JackHodson in PHP for Windows, PHP Scripting Language, PHP Installation

Dear all,

I have a script written for me by a member here some while ago.
I am using it on a new website and when I try to upload a large photo it is failing and comes back blank - it does not say the upload failed, simply it comes back blank (the header and footer of the website comes back but anything within the PHP does not.

For small photos it works well and uploads it to the folder.

I have tried increasing the following using a .htaccess file:
memory_limit to 100MB
post_max_size to 100MB
upload_max_filesize to 100Mb

still it did not work. the defaults are now set again and they are:
memory_limit to 24MB
post_max_size to 8MB
upload_max_filesize to 10Mb.

The code is pasted below and the php settings are here:
http://arockes.org.uk/images/user_photo_uploads/php_info.php

The uploader web page is here: http://arockes.org.uk/photo_uploader.php

PHP is something that does not make a huge amount of sense to me so if you could shed any light on this I would really appreciate it.

Kind regards,
Jack
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
<br />
    <?
     if($_SERVER['REQUEST_METHOD']!='POST') {
?>
  </p>
  <p>  </p>
  <form action="<? echo $_SERVER['PHP_SELF'] ?>" method="post" enctype="multipart/form-data" name="Photo Uploader" id="Photo Uploader">
  <table width="375" style="background-color: #FFFFFF;border:1px solid; border-color:#DDDDDD;" border="0" cellspacing="2" cellpadding="2">
    <tr>
      <td width="365" style="font-weight:normal; color:#000000;background-color:#FFFFFF;">Upload your car or event photos here:</td>
    </tr>
    <tr>
      <td style="text-align:left"><input name="file" type="file" size="35" /></td>
    </tr>
    <tr>
      <td style="text-align:center"><input type="submit" name="Submit" value=":.Send.:" /></td>
    </tr>
  </table>
</form>
<?
} else {
     $message = "";
     $validExtensions[] = "jpg";
     $validExtensions[] = "jpeg";
      $validExtensions[] = "gif";
      $validExtensions[] = "png";
     $sentFileSize = ceil($_FILES['file']['size']/1024);
      # this way is more accurate for the extension
     $sentFileExtension = explode(".", $_FILES['file']['name']);
      $number = count($sentFileExtension);
      $sentFileExtension = strtolower($sentFileExtension[$number-1]);
 
      if(!in_array($sentFileExtension, $validExtensions)) {
           $message = "<span style=\"color:black; font size:11px\"><br>Your photo has <span style=\"color:red\">NOT</span> been uploaded,";
           $message .= " because of an invalid file type. <br>We only accept .JPG, .GIF and .PNG files.</span>";
      } else {
           // SAVE THE FILE
           $uploaddir = 'images/user_photo_uploads/';
           if (file_exists('images/photo_uploader_count.txt')) {
                $handle = fopen('images/photo_uploader_count.txt','r+');
                $newFileNumber = fread($handle,filesize('images/photo_uploader_count.txt'))+1;
                fclose($handle);
                $handle = fopen('images/photo_uploader_count.txt','w');
                fwrite($handle,$newFileNumber.'');
                fclose($handle);
           } else {
                $handle = fopen('images/photo_uploader_count.txt','x');
                fwrite($handle,'1');
                $newFileNumber = 1;
           }
           $uploadfile = $uploaddir . basename($newFileNumber . "." . $sentFileExtension);
 
 
                $bron = $_FILES['file']['tmp_name'];
                $maxbreedte = 1024;
                }
 
                if(!empty($bron)){
                     $dimensies = getimagesize($bron);
                     $breedte = $dimensies[0];
                     $hoogte = $dimensies[1];
                     if($breedte > $maxbreedte){
                          $nieuwebreedte = $maxbreedte;
                          $deelfactor = $breedte / $maxbreedte;
                          $nieuwehoogte = $hoogte / $deelfactor;
 
                          switch ($dimensies['mime']) {
 
                          case 'image/jpeg':
 
                               $image = imagecreatefromjpeg($bron);
                               $destination = imagecreatetruecolor($nieuwebreedte, $nieuwehoogte);
                               imagecopyresampled($destination, $image, 0, 0, 0, 0, $nieuwebreedte, $nieuwehoogte, $breedte, $hoogte);
                               imagejpeg($destination, $uploadfile);
                              imagedestroy($image);
                              imagedestroy($destination);
                          break;
 
                          case 'image/gif':
 
                               $image = imagecreatefromgif($bron);
                               $destination = imagecreate($nieuwebreedte, $nieuwehoogte);
                               imagecopyresampled($destination, $image, 0, 0, 0, 0, $nieuwebreedte, $nieuwehoogte, $breedte, $hoogte);
                               imagegif($destination, $uploadfile);
                              imagedestroy($image);
                              imagedestroy($destination);
                          break;
 
                          case 'image/png':
 
                               $image = imagecreatefrompng($bron);
                               $destination = imagecreate($nieuwebreedte, $nieuwehoogte);
                               imagecopyresampled($destination, $image, 0, 0, 0, 0, $nieuwebreedte, $nieuwehoogte, $breedte, $hoogte);
                               imagepng($destination, $uploadfile);
                              imagedestroy($image);
                              imagedestroy($destination);
                          break;
                          }
                     } else {
                          $uploadfile = $uploaddir . basename($newFileNumber. "." .$sentFileExtension);
                             if (move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile)) {
                               chmod($uploadfile, 0644);
                               $message = "Your photo has been saved successfully, to upload another, click Back and repeat.<br>";
                         
                          } else {
                               $message = "There was an error uploading the file, please try again!";
                          }
                     }
                }
           if (is_file($uploadfile)) {
                $message = "<span style=\"color:black; font size:11px\"><br>Your photo has been saved successfully, to upload<br>another, click your browsers back button and repeat.<br>";
 
           } else {
                $message .= "<span style=\"color:black; font size:11px\"><br><br>Please click your browsers back button to try again.";
           }
?>
<br /><table width="500" style="background-color:#FFFFFF;border:1px solid; border-color:#DDDDDD;" border="0" cellspacing="2" cellpadding="2">
  <tr>
    <td style="font-weight:normal; color:#000000;background-color:#FFFFFF;">Photo upload result:</td>
  </tr>
  <tr>
    <td style="text-align:center"><? echo $message ?></td>
  </tr>
</table>
<?
}
?>
[+][-]07/03/09 05:54 AM, ID: 24772010Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: PHP for Windows, PHP Scripting Language, PHP Installation
Sign Up Now!
Solution Provided By: Jagarm
Participating Experts: 2
Solution Grade: C
 
[+][-]07/03/09 06:12 AM, ID: 24772107Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07/03/09 06:16 AM, ID: 24772128Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/03/09 06:27 AM, ID: 24772199Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07/03/09 06:32 AM, ID: 24772226Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/03/09 06:34 AM, ID: 24772231Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/03/09 06:46 AM, ID: 24772301Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07/03/09 06:49 AM, ID: 24772314Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/03/09 06:50 AM, ID: 24772319Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/03/09 06:52 AM, ID: 24772328Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07/03/09 07:49 AM, ID: 24772697Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07/03/09 07:59 AM, ID: 24772756Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/03/09 08:18 AM, ID: 24772856Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/03/09 08:50 AM, ID: 24773083Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07/03/09 08:53 AM, ID: 24773119Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07/03/09 08:53 AM, ID: 24773123Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/03/09 08:56 AM, ID: 24773139Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07/03/09 09:00 AM, ID: 24773172Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/03/09 09:08 AM, ID: 24773204Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/03/09 09:11 AM, ID: 24773217Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/03/09 09:20 AM, ID: 24773277Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07/03/09 09:22 AM, ID: 24773289Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/03/09 09:24 AM, ID: 24773297Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/03/09 10:01 AM, ID: 24773468Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/03/09 10:49 AM, ID: 24773677Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07/03/09 10:53 AM, ID: 24773687Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/03/09 10:56 AM, ID: 24773697Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07/03/09 10:58 AM, ID: 24773708Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/03/09 11:03 AM, ID: 24773727Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07/03/09 11:08 AM, ID: 24773735Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/03/09 11:11 AM, ID: 24773750Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07/03/09 11:22 AM, ID: 24773799Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/03/09 11:31 AM, ID: 24773837Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07/03/09 11:35 AM, ID: 24773851Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/03/09 11:44 AM, ID: 24773878Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07/03/09 11:45 AM, ID: 24773884Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07/03/09 11:49 AM, ID: 24773899Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/03/09 11:58 AM, ID: 24773943Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/03/09 11:59 AM, ID: 24773950Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/03/09 04:10 PM, ID: 24774901Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07/03/09 09:15 PM, ID: 24775687Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/04/09 02:34 AM, ID: 24776431Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07/10/09 08:29 AM, ID: 24824319Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07/10/09 08:56 AM, ID: 24824621Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/10/09 09:00 AM, ID: 24824666Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07/10/09 09:01 AM, ID: 24824677Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07/10/09 09:03 AM, ID: 24824699Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/10/09 09:04 AM, ID: 24824706Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08/18/09 03:35 AM, ID: 25121666Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-89 - Hierarchy / EE_QW_3_20080625