Jump to content


Photo

Include() problem....


  • Please log in to reply
3 replies to this topic

#1 GremlinP1R

GremlinP1R
  • Members
  • PipPipPip
  • Advanced Member
  • 62 posts
  • LocationSouth Africa

Posted 18 October 2006 - 08:21 AM

Hi there all.

I have done the file handeling tutorial of PHPFreaks but have a huge problem...
As soon as I include() that class file for the file uploading, my script goes blank it just dissapear...
And maybe if I can get that sorted I will be able to get the thing to work...

Please Help me.... Don't know where to start looking....

Thanx.

#2 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 18 October 2006 - 08:22 AM

Try to put
error_reporting(E_ALL);
on the top of your page and see if it returns any errors.

#3 GremlinP1R

GremlinP1R
  • Members
  • PipPipPip
  • Advanced Member
  • 62 posts
  • LocationSouth Africa

Posted 18 October 2006 - 06:27 PM

Help.... I used that code and it helped a lot thanx, quite a handy tool to have...

Sorted all errors out on the class script but now have a new problem.... I'm getting this....

Notice: Undefined index: upload in C:\wamp\www\P1R\memberspages\addmembers.php on line 339

Notice: Undefined index: upload in C:\wamp\www\P1R\memberspages\addmembers.php on line 340


Okay now I think that my problem are here some where and it just don't feel and look right it just look if I'm shorting something....

   
// When Submitting
   if (isset($_POST['Submit'])){
       include('uploadclass.php');
   // Set upload info
      $upload_class = new Upload_Files;
      $upload_class -> temp_file_name = trim($_FILES['upload']['tmp_name']);      // line 339
      $upload_class -> file_name = trim(strtolower($_FILES['upload']['name']));     // line 340
      $upload_class -> upload_dir = "images/cars/";
      $upload_class -> upload_log_dir = "images/uploadlog/";
      $upload_class -> max_file_size = 5000000;
      $upload_class -> banned_array = array(" ");
      $upload_class -> ext_array = array(" .jpg", " .gif", " .jpeg", " .png", " .bmp");
	  
   // Calling class Functions
      $valid_ext = $upload_class -> validate_extensions();   
      $valid_size = $upload_class -> validate_size();
      $valid_user = $upload_class -> validate_user();
      $max_size = $upload_class -> get_max_size();
      $file_size = $upload_class -> get_file_size();
      $upload_directory = $upload_class -> get_upload_dir();
      $upload_log_directory = $upload_class -> get_upload_log_dir();
      $upload_file = $upload_class -> upload_file_with_validation();
   
   // Errors
      if (!$valid_ext){ $result = "file ext";}
	  elseif (!$valid_size){ $result = "size";}
	  elseif (!$valid_user){ $result = "user";}
	  elseif ($file_exists){ $result = "exists";}
	  else {$upload_file = $upload_class -> upload_file_with_validation();
	      if(!$upload_file){ $result = "Not Uploaded";}
		  else{ $result = "Success";}
	      }
	  } 

Please help.... Thanx

#4 Destruction

Destruction
  • Members
  • PipPipPip
  • Advanced Member
  • 108 posts

Posted 18 October 2006 - 07:10 PM

$_FILES['upload'] is the part it's talking of.  An undefined index means the array index/key isn't defined anywhere.  $_FILES['upload'] should be the name of the field in your form ie:

<input type="file" name="upload"/>

If you use a different name there, they need to match either way.

HTH

Dest




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users