Jump to content

Why do i get this error: Undefined index: filef42 ?


jd2007

Recommended Posts

i'm doing this:

 

if (file_exists($_FILES['filef']['name']))
	{
           if (filesize($_FILES['filef']['size'])>=3000000)
		{
              echo "Flash is good !";
		}
		else
		{
              echo "Flash too large";
		}
	}
      else
	{
          echo "Flash doesn't exist";
	  $error=error_get_last();
	  echo $error['message'];
	  echo $error['line'];
	}

this is the full code:

 

<?php

class FlashUploader
{
  private $host;
  private $username;
  private $password;
  private $db;
  private $table;
  private $title;
  private $brief;
  private $main;
  private $checkboxes;
  private $flash;
  private $thumb;
  private $author;
  private $submitted;
  private $score;
  private $size;

  function connectdb($l, $u, $p, $d)
{
      $this->host=$l;
      $this->username=$u;
  $this->password=$p;
  $this->db=$d;
  mysql_connect($this->host, $this->username, $this->password);
  mysql_select_db($this->db);
}

  function getandsendDetails($ftitle, $fbrief, $fmain, $fcbx, $aut, $subm, $sc)
{
  $this->checkboxes=explode("/", $fcbx);
      $this->que="insert into videos (title, brief, main, author, submitted, size) values ($this->title, $this->brief, $this->main, $this->author, $this->submitted, $this->size)";
  $this->res=mysql_query($this->que);
}

function checkFiles($file, $thumbnail)
{ 
	//$this->flash=$file;
	//$this->thumb=$thumbnail;
      if (file_exists($_FILES['filef']['name']))
	{
           if (filesize($_FILES['filef']['size'])>=3000000)
		{
              echo "Flash is good !";
		}
		else
		{
              echo "Flash too large";
		}
	}
      else
	{
          echo "Flash doesn't exist";
	  $error=error_get_last();
	  echo $error['message'];
	  echo $error['line'];
	}
}

function moveFiles()
{
      move_uploaded_file($_FILES["filef"]["tmp_name"], "a/");
}
}

$flashupload=new FlashUploader;
$flashupload->connectdb("localhost", "root", "*****", "videoportal");
$x=$flashupload->checkFiles('', '');
if ($x=="Flash is good !")
{
$flashupload->moveFiles($_FILES["filef"], $_FILES["file2f"]);
if (!$flashupload->moveFiles($_FILES["filef"], $_FILES["file2f"]))
{
  echo "File could not be uploaded";
}
else
{
$flashupload->getandsendDetails($_POST["textfield4"], $_POST["textfield5"], $_POST["textfield52"], $_GET["arr"], "jd2007", "2", "0");
}
}
else
{
echo $x;
}


?>

 

line 42

Archived

This topic is now archived and is closed to further replies.

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