Get ready for BLACK FRIDAY shopping starting in

Forums

PHP

This topic is locked

PHP Pure Upload - Running code from another file

Posted 04 Jul 2008 19:36:18
1
has voted
04 Jul 2008 19:36:18 Nelson Cardoso posted:
Hi all,

I have a form on a page... people fill it out and a few things happen....

On same page as form:
1 - Form validation (javascript on same page)
2 - Captcha

On next page called from form action:
1 - Send notification emails
2 - Insert record in mysql database (generic DW insert that I moved over to this page)
3 - Upload image (using PHP pure upload)
4 - Redirect

My problem... everything works except for the upload. I inserted the call to "ScriptLibrary/incPureUpload.php" and yes my path is correct <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

I inserted the generated code just above the insert code...

Any ideas as to why this wouldn't work? I never even see the status images pop up.

Thanks in advance.

Nelson

Replies

Replied 04 Jul 2008 20:24:35
04 Jul 2008 20:24:35 Nelson Cardoso replied:
I figured I should include the code I'm using for the upoad and insert part... keep in mind that this is an edited version of the upload and insert script. The insert works fine... but it doesn't seem to call the upload part.

&lt;?php require_once('../Connections/conn_ilhas.php'); ?&gt;
&lt;?php require_once('../ScriptLibrary/incPureUpload.php'); ?&gt;
&lt;?php
// Pure PHP Upload 2.1.3
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "rentalinfo") {
$ppu = new pureFileUpload();
$ppu-&gt;path = "../images/locations";
$ppu-&gt;extensions = "GIF,JPG,JPEG";
$ppu-&gt;formName = "rentalinfo";
$ppu-&gt;storeType = "file";
$ppu-&gt;sizeLimit = "100 kb";
$ppu-&gt;nameConflict = "over";
$ppu-&gt;requireUpload = "false";
$ppu-&gt;minWidth = "300";
$ppu-&gt;minHeight = "300";
$ppu-&gt;maxWidth = "800";
$ppu-&gt;maxHeight = "800";
$ppu-&gt;saveWidth = "";
$ppu-&gt;saveHeight = "";
$ppu-&gt;timeout = "600";
$ppu-&gt;progressBar = "fileCopyProgress.htm";
$ppu-&gt;progressWidth = "300";
$ppu-&gt;progressHeight = "100";
$ppu-&gt;checkVersion("2.1.3";
$ppu-&gt;doUpload();
$GP_uploadAction .= "?"."GP_upload=true";
}
?&gt;
&lt;?php
if (!function_exists("GetSQLValueString") {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "",
$theNotDefinedValue = ""
{
$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;
}
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "rentalinfo") {
$insertSQL = sprintf("INSERT INTO properties (island, location, name,
picture, contact, email, phone, cell, occupants, bedrooms, bed1, bed2, bed3,
bed4, bed5, bathrooms, kitchen, diningroom, livingroom, patio, cable,
internetaccess, washerdryer, kitchenutencils, `description`, `description_en`, `description_fr`, `description_du`, price, price_time,
entrydate, status) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,
%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['island'], "text",
GetSQLValueString($_POST['location'], "text",
GetSQLValueString($_POST['name'], "text",
GetSQLValueString($_POST['picture'], "text",
GetSQLValueString($_POST['contact'], "text",
GetSQLValueString($_POST['email'], "text",
GetSQLValueString($_POST['phone'], "text",
GetSQLValueString($_POST['cell'], "text",
GetSQLValueString($_POST['occupants'], "int",
GetSQLValueString($_POST['bedrooms'], "int",
GetSQLValueString($_POST['bed1'], "int",
GetSQLValueString($_POST['bed2'], "int",
GetSQLValueString($_POST['bed3'], "int",
GetSQLValueString($_POST['bed4'], "int",
GetSQLValueString($_POST['bed5'], "int",
GetSQLValueString($_POST['bathrooms'], "int",
GetSQLValueString($_POST['kitchen'], "int",
GetSQLValueString($_POST['diningroom'], "int",
GetSQLValueString($_POST['livingroom'], "int",
GetSQLValueString($_POST['patio'], "int",
GetSQLValueString($_POST['cable'], "int",
GetSQLValueString($_POST['internetaccess'], "int",
GetSQLValueString($_POST['washerdryer'], "int",
GetSQLValueString($_POST['kitchenutencils'], "int",
GetSQLValueString($_POST['description'], "text",
GetSQLValueString($_POST['description_en'], "text",
GetSQLValueString($_POST['description_fr'], "text",
GetSQLValueString($_POST['description_du'], "text",
GetSQLValueString($_POST['price'], "int",
GetSQLValueString($_POST['price_time'], "text",
GetSQLValueString($_POST['entrydate'], "text",
GetSQLValueString($_POST['status'], "text");
mysql_select_db($database_conn_ilhas, $conn_ilhas);
$Result1 = mysql_query($insertSQL, $conn_ilhas) or die(mysql_error());
}
?&gt;

Reply to this topic