Jump to content

Include() problem....


GremlinP1R

Recommended Posts

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.
Link to comment
Share on other sites

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....

[quote]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

[/quote]

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....

[code] 
// 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";}
      }
  }
[/code]

Please help.... Thanx
Link to comment
Share on other sites

$_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
Link to comment
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.