Pure PHP Upload 2 Support Product Page

Files Not Uploading with Pure PHP Upload 2

Asked 16 Jan 2011 01:41:57
1
has this question
16 Jan 2011 01:41:57 Alicia Walton posted:
I am trying to use Pure PHP Upload 2 to upload photos and it isn't working. After I submit my form, I checked my database and the information I submitted from the other form fields is there. However, I do not see any of the files in my upload folder that I tried to upload. Also, the pictures are obviously not appearing on the page where my recordset is created.

Below are my codes:


// Pure PHP Upload 2.1.10
$ppu = new pureFileUpload();
$ppu->path = "Photos";
$ppu->extensions = "GIF,JPG,JPEG,BMP,PNG";
$ppu->formName = "individual";
$ppu->storeType = "file";
$ppu->sizeLimit = "";
$ppu->nameConflict = "ove[v]r";
$ppu->requireUpload = "false";
$ppu->minWidth = "";
$ppu->minHeight = "";
$ppu->maxWidth = "";
$ppu->maxHeight = "";
$ppu->saveWidth = "";
$ppu->saveHeight = "";
$ppu->timeout = "600";
$ppu->progressBar = "";
$ppu->progressWidth = "";
$ppu->progressHeight = "";
$ppu->redirectURL = "";
$ppu->checkVersion("2.1.10");
$ppu->doUpload();

if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if (isset($editFormAction)) {
  if (isset($_SERVER['QUERY_STRING'])) {
	  if (!eregi("GP_upload=true", $_SERVER['QUERY_STRING'])) {
  	  $editFormAction .= "&GP_upload=true";
		}
  } else {
    $editFormAction .= "?GP_upload=true";
  }
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "individual")) {
  $insertSQL = sprintf("INSERT INTO single (Posting_Title) VALUES (%s)",
                       GetSQLValueString($_POST['posting_title'], "text"));

  mysql_select_db($database_bridesmaidsrack_db, $bridesmaidsrack_db);
  $Result1 = mysql_query($insertSQL, $bridesmaidsrack_db) or die(mysql_error());

  $insertGoTo = "Shoes2.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $insertGoTo));
}


Replies

Replied 18 Jan 2011 10:46:35
18 Jan 2011 10:46:35 Miroslav Zografski replied:
Follow Up from chat with Alicia:

You have firstly not set up correctly the Insert Record behavior. Second, you have your database table fields in incorrect type ( mediumblob ) and third your folder permissions were restricting the script from writing and modifying the upload folder.

Regards,

Reply to this topic