Help needed with the image update on form.

Hello,

I would like some help understanding something to do with the update of my form.

Text fields update fine, images that already exist on my server update fine.

-------but----------------

Images not on my server, do not get added to any of my destination (target) folders. Web browser gives no apparent error messages, and the display pic of the newly added image only displays the Red, Blue and Green image placeholder. - no image?

I believe it to be something to do with the target folders however im asking for some guidance/advice on what?

Firstly my page with the form, where users choose to change the image/display pic:

View01.php:

[code]<?PHP

ini_set(‘display_errors’,1);
error_reporting(E_ALL);

session_start();
if(!isset($_SESSION[‘id’]) || !isset($_SESSION[‘valid_user’]) || $_SESSION[‘valid_user’] != “yes”) {
$_SESSION = array();
session_destroy();
header(“Location: index.php”);
exit();
}

include (‘php only scripts/db.php’);
$id = $_GET[‘id’];

$query =“SELECT * FROM companies WHERE id = ‘$id’”;
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result);

?>

Removalspace.com
Logo here
imagesenter your postcode hereimages

 

 

e.g first two letters and number: i.e: AA1 or AA12

Become a fanFollows on TwitterLinked inContact

Search Removals |

Search Storage |

Add Listing |

About |

Contact |

Login

	</tr>
    <tr>
		<td><div class="abox">
  <figure>
  <fcapion>
  <h2>
    <h1>Company Location:</h1>
    <h1><?PHP 
			echo $row['street1'] . 
			"<br>" . $row['street2'] . 
			"<br>" . $row['city'] . "," .  $row['postcode'] ; 
			?>
  </h1></h2>
  <h1></img></h1>
  </fcaption></figure>

Your Logo:

logo

Contact Details:

<?PHP echo "phone: " . $row['phone'] . "
email: " . $row['email'] . "
website: " . $row['website'] ; ?>

<?PHP /* create an email validation function */ function validateEmailAddress($email) { return filter_var($email, FILTER_VALIDATE_EMAIL) && preg_match('/@.+\./', $email); } /** * CALLBACK - determine if the provided postcode is valid. * * @param string $postcode * @return bool TRUE if valid, FALSE otherwise * @author George Edwards */ function is_valid_uk_postcode($postcode) { $pattern = "/^([A-PR-UWYZ0-9][A-HK-Y0-9][AEHMNPRTVXY0-9]?[ABEHMNPRVWXY0-9]? {1,2}[0-9][ABD-HJLN-UW-Z]{2}|GIR 0AA)$/";
if (preg_match($pattern, $postcode)) {
    return TRUE;
}

$this->validation->set_message('is_valid_uk_postcode', 'That is not a valid %s.');
return FALSE;

}
/* FUNCTION TO CREATE SALT /
function createSalt() {
$string = md5(uniqid(rand(), true));
return substr($string, 0, 3);
}
/
check if form was submitted /
if (isset($_POST[‘Submit’])){
$error_message = “”;
/
This is the directory where images will be saved /
$target = “/home/users/web/b109/ipg.removalspacecom/images/COMPANIES/”;
$target = $target . basename( $_FILES[‘upload’][‘name’]);
/
include validation script /
include (‘php only scripts/validation.php’);
$uploadDir = ‘images/COMPANIES’; /
main picture folder /
$max_height = 450; /
largest height you allowed; 0 means any /
$max_width = 450; /
largest width you allowed; 0 means any /
$max_file = 2000000; /
set the max file size in bytes /
$image_overwrite = 1; /
0 means overwite; 1 means new name /
/
add or delete allowed image types /
$allowed_type01 = array( “image/gif”, “image/pjpeg”, “image/jpeg”, “image/png”, “image/x-png”, “image/jpg”);
$do_thumb = 1; /
1 make thumbnails; 0 means do NOT make /
$thumbDir = “/images/thumbs”; /
thumbnail folder /
$thumb_prefix = “”; /
prefix for thumbnails /
$thumb_width = 90; /
max thumb width /
$thumb_height = 70; // max thumb height
//Writes the photo to the server
if(move_uploaded_file($_FILES[‘upload’][‘tmp_name’], $target)) {
/
HERE IS WHERE WE WILL DO THE ACTUAL RESIZING /
/
THESE SIX PARAMETERS MAY BE CHANGED TO SUIT YOUR NEEDS /
$upload = $_FILES[‘upload’][‘name’];
$o_path =“images/COMPANIES/”;
$s_path = “images/thumbs/”;
$file = $upload;
$save = $file;
$t_w = 200;
$t_h = 150;
/
DO NOT CHANGE THIS NEXT LINE /
Resize_Image($save,$file,$t_w,$t_h,$s_path,$o_path);
}else{
//Gives and error if its not
$error_message .= “Sorry, there was a problem uploading your file.”;
}
/
PREPARE DATA FOR INSERTION INTO TABLE */
//Writes the information to the database
if(strlen(trim($error_message)) <1){
$salt = createsalt();
$username = trim($_POST[‘username’]);
$password = trim($_POST[‘password’]);
$hash = hash(‘sha256’, $salt, $password);
$approved = 0;
$company_name = mysql_real_escape_string(trim($_POST[‘company_name’]));
$website = mysql_real_escape_string(trim($_POST[‘website’]));
$contact_name = mysql_real_escape_string(trim($_POST[‘contact_name’]));
$location = mysql_real_escape_string(trim($_POST[‘location’]));
$postcode = mysql_real_escape_string(trim($_POST[‘postcode’]));
$street1 = mysql_real_escape_string(trim($_POST[‘street1’]));
$street2 = mysql_real_escape_string(trim($_POST[‘street2’]));
$city = mysql_real_escape_string(trim($_POST[‘city’]));
$phone = mysql_real_escape_string(trim($_POST[‘phone’]));
$phone2 = mysql_real_escape_string(trim($_POST[‘phone2’]));
$email = mysql_real_escape_string(trim($_POST[‘email’]));
$premiumuser_description = mysql_real_escape_string(trim($_POST[‘premiumuser_description’]));
$salt = mysql_real_escape_string($salt);
$upload = mysql_real_escape_string($upload);
$query =“INSERT INTO companies (company_name, what_services, website, contact_name, location, postcode, street1, street2, city, phone,phone2, email, premiumuser_description, username, password, salt, approved, upload) VALUES (’$company_name’, ‘$what_services’, ‘$website’, ‘$contact_name’, ‘$location’, ‘$postcode’, ‘$street1’, ‘$street2’, ‘$city’, ‘$phone’, ‘$phone2’, ‘$email’, ‘$premiumuser_description’, ‘$username’, ‘$hash’, ‘$salt’, ‘$approved’, ‘$upload’)”;
$result = mysql_query($query) or die(mysql_error());
if ($result) {

		}
	 
	/* at this point we can send an email to the admin as well as the user.  DO NOT send the user's password to ANYONE!!!! */ 
}

}//if (isset($_POST[‘submit’]))
?>

<?php if (!empty($error_message)){ echo $error_message; } ?>


Edit Your details

fill out the form with your details...

 

 

Click submit to update...

 

 

 

 

Website:

 

 

Primary Number:

 

 

Secondary Number:

 

 

Company Description:

Write a description of what your company does, the services it offers and any additional information here.

 

Images:

Upload your company image here.

 

 

[/code]

Secondly view02.php processes the form’s data to use UPDATE.

View02.php:

[code]<?php

include (‘php only scripts/db.php’);
include(‘php only scripts/resize.php’);
$id = intval($_GET[‘id’]); // guarantee it’s a harmless number value

if (isset($_GET[‘website’]) && $_GET[‘website’]) { // does the GET value exists and has it a value ?
$website = mysql_real_escape_string($_GET[‘website’]); // get its value and escape it
$setArray[] = “website = ‘$website’”; // ok to update this field in the query so store it
}
if (isset($_GET[‘phone’]) && $_GET[‘phone’]) {
$phone = mysql_real_escape_string($_GET[‘phone’]);
$setArray[] = “phone = ‘$phone’”;
}
if (isset($_GET[‘phone2’]) && $_GET[‘phone2’]) {
$phone2 = mysql_real_escape_string($_GET[‘phone2’]);
$setArray[] = “phone2 = ‘$phone2’”;
}
if (isset($_GET[‘premiumuser_description’]) && $_GET[‘premiumuser_description’]) {
$premiumuser_description = mysql_real_escape_string($_GET[‘premiumuser_description’]);
$setArray[] = “premiumuser_description = ‘$premiumuser_description’”;
}
if (isset($_GET[‘username’]) && $_GET[‘username’]) {
$username = mysql_real_escape_string($_GET[‘username’]);
$setArray[] = “username = ‘$username’”;
}
if (isset($_GET[‘password’]) && $_GET[‘password’]) { // These are the same so you’d need to make them different if your comparing the password to ensure they entered it correctly ex: $_GET[‘password1’] for another field in your form
$password= mysql_real_escape_string($_GET[‘password’]); // This is fine if the 2 values above are first compared
$setArray[] = “password = SHA(’$password’)”; // If they are compared and validation checks out then just do the query to update the password here…
}
if (isset($_GET[‘upload’]) && $_GET[‘upload’]) {
$upload = mysql_real_escape_string($_GET[‘upload’]);
$setArray[] = “upload = ‘$upload’”;
}
/* check if form was submitted /
if (isset($_POST[‘Submit’])){
$error_message = “”;
/
This is the directory where images will be saved /
$target = “/home/users/web/b109/ipg.removalspacecom/images/COMPANIES/”;
$target = $target . basename( $_FILES[‘upload’][‘name’]);
/
include validation script /
include (‘php only scripts/validation.php’);
$uploadDir = ‘/home/users/web/b109/ipg.removalspacecom/images/COMPANIES’; /
main picture folder /
$max_height = 450; /
largest height you allowed; 0 means any /
$max_width = 450; /
largest width you allowed; 0 means any /
$max_file = 2000000; /
set the max file size in bytes /
$image_overwrite = 1; /
0 means overwite; 1 means new name /
/
add or delete allowed image types /
$allowed_type01 = array(“image/gif”, “image/pjpeg”, “image/jpeg”, “image/png”, “image/x-png”, “image/jpg”);
$do_thumb = 1; /
1 make thumbnails; 0 means do NOT make /
$thumbDir = “/home/users/web/b109/ipg.removalspacecom/images/thumbs”; /
thumbnail folder /
$thumb_prefix = “”; /
prefix for thumbnails /
$thumb_width = 90; /
max thumb width /
$thumb_height = 70; // max thumb height
//Writes the photo to the server
if(move_uploaded_file($_FILES[‘upload’][‘tmp_name’], $target)) {
/
HERE IS WHERE WE WILL DO THE ACTUAL RESIZING /
/
THESE SIX PARAMETERS MAY BE CHANGED TO SUIT YOUR NEEDS /
$upload = $_FILES[‘upload’][‘name’];
$o_path =“images/COMPANIES/”;
$s_path = “images/thumbs/”;
$file = $upload;
$save = $file;
$t_w = 200;
$t_h = 150;
/
DO NOT CHANGE THIS NEXT LINE */

	Resize_Image($save,$file,$t_w,$t_h,$s_path,$o_path);
}else{ 
	//Gives and error if its not 
	$error_message .= "Sorry, there was a problem uploading your file."; 
}}

if (count($setArray) > 0) { // do we have at least on field to update?
$setstr = join (’, ', $setArray); // form a comma separated string of our updates
$query = “UPDATE companies SET $setstr WHERE id = $id”; // update it
echo $query;
mysql_query($query) or die(mysql_error());
}
header(“Location: view01.php?id=” . $id);
exit(0);

?>[/code]

Near the destination folder this line:

if(move_uploaded_file($_FILES['upload']['tmp_name'], $target)) { 

Copies the image to the target folder but i already have a destination folder.

Which one is it that i have to get rid of (if this is the problem)…

If any of you guys could please help me, as im a bit stuck at the moment with this one. Stuck being brain dead as i have looked at it far too much now, and it’s turning into a blurrrrrr.

Thank you in advance, if you need any more info, let me know. Cheers.

Hi andy_b_1502,

The first thing I notice is that your form’s submit is named “submit” but you are checking for “Submit” in several places. Try using the following line in your View01.php instead[php]

[/php]

Lets try this first and then we will move on if it doesn’t solve the problem.

Hi, thank you for that.

I have changed that line from lower case to upper case.

This hasn’t fixed any problems though just yet.

Is $row getting assigned somewhere outside of the View01.php form? It might be getting set in your include(validation.php).

Lets use the following for your View02.php for testing:[php]<?php
echo ‘

’;
print_r($_POST);
print_r($_FILES);

/* check if form was submitted /
if (isset($_POST[‘Submit’])){
$error_message = “”;
/
This is the directory where images will be saved /
$target = “/home/users/web/b109/ipg.removalspacecom/images/COMPANIES/”;
if(!is_dir($target)) echo “1. Directory Doesn’t Exist: $target
”;
$target = $target . basename( $_FILES[‘upload’][‘name’]);
/
include validation script /
// include (‘php only scripts/validation.php’);
$uploadDir = ‘/home/users/web/b109/ipg.removalspacecom/images/COMPANIES’; /
main picture folder /
$max_height = 450; /
largest height you allowed; 0 means any /
$max_width = 450; /
largest width you allowed; 0 means any /
$max_file = 2000000; /
set the max file size in bytes /
$image_overwrite = 1; /
0 means overwite; 1 means new name /
/
add or delete allowed image types /
$allowed_type01 = array(“image/gif”, “image/pjpeg”, “image/jpeg”, “image/png”, “image/x-png”, “image/jpg”);
$do_thumb = 1; /
1 make thumbnails; 0 means do NOT make /
$thumbDir = “/home/users/web/b109/ipg.removalspacecom/images/thumbs”; /
thumbnail folder /
if(!is_dir($thumbDir)) echo “2. Directory Doesn’t Exist: $thumbDir
”;
$thumb_prefix = “”; /
prefix for thumbnails /
$thumb_width = 90; /
max thumb width /
$thumb_height = 70; // max thumb height
//Writes the photo to the server
if(move_uploaded_file($_FILES[‘upload’][‘tmp_name’], $target)) {
/
HERE IS WHERE WE WILL DO THE ACTUAL RESIZING /
/
THESE SIX PARAMETERS MAY BE CHANGED TO SUIT YOUR NEEDS /
$upload = $_FILES[‘upload’][‘name’];
$o_path =“images/COMPANIES/”;
if(!is_dir($o_path)) echo “3. Directory Doesn’t Exist: $o_path
”;
$s_path = “images/thumbs/”;
if(!is_dir($s_path)) echo “4. Directory Doesn’t Exist: $s_path
”;
$file = $upload;
$save = $file;
$t_w = 200;
$t_h = 150;
/
DO NOT CHANGE THIS NEXT LINE */

  Resize_Image($save,$file,$t_w,$t_h,$s_path,$o_path);

}else{
//Gives and error if its not
$error_message .= “Sorry, there was a problem uploading your file.”;
}}
exit(0);
?>[/php]

See what kind of output you receive. This should display your $_POST array and your $_FILES array. In addition, it will check each of your directories to ensure they exist.

Please let me know what you get…

Thanks,

All that is outputted to the browser when i try to change image (use view02.php code) is this:

Array
(
)
Array
(
)

Sorry I wasn’t clear on this. Go through the process of submitting an image using the form and see what is output.

That is what is output ^^

I edited view02.php to what you suggested and ftp’d it to the server.

Logged into a test profile, chose an image to UPDATE and that is what is displayed after i click submit…

:-X That isn’t what I was hoping to hear…

Lets see what happens if you replace View02.php entirely with the following:[php]<?php
echo '$_REQUEST: ';
echo ‘

’;
print_r($_REQUEST);
?>[/php]

One other thing to check. It was probably just a typo, but you original used View02.php for the filename and later view02.php - Since this is case sensitive, I just want to make sure we are calling the right file.

Let me know what you get after submitting the form again…

Yeah the upper/lower case was me being awkward/rookie :frowning: defo lower case v.

Heres the latest results with that code:

$_REQUEST:
Array
(
[id] => 81
[website] =>
[phone] =>
[phone2] =>
[premiumuser_description] =>
[upload] => van2.png
[Submit] => submit
[eucookie] => eucookie
[PHPSESSID] => 3db01d94b217734f9d65c3bbd871196e
[__utmb] => 95372959.2.10.1348509880
)

Very strange,

Lets try it again with this code:[php]<?php
echo ‘

’;
echo 'POST:
';
print_r($_POST);
echo 'FILES:
';
print_r($_FILES);
echo 'REQUEST:
';
print_r($_REQUEST);

/* check if form was submitted /
if (isset($_POST[‘Submit’])){
$error_message = “”;
/
This is the directory where images will be saved /
$target = “/home/users/web/b109/ipg.removalspacecom/images/COMPANIES/”;
if(!is_dir($target)) echo “1. Directory Doesn’t Exist: $target
”;
$target = $target . basename( $_FILES[‘upload’][‘name’]);
/
include validation script /
// include (‘php only scripts/validation.php’);
$uploadDir = ‘/home/users/web/b109/ipg.removalspacecom/images/COMPANIES’; /
main picture folder /
$max_height = 450; /
largest height you allowed; 0 means any /
$max_width = 450; /
largest width you allowed; 0 means any /
$max_file = 2000000; /
set the max file size in bytes /
$image_overwrite = 1; /
0 means overwite; 1 means new name /
/
add or delete allowed image types /
$allowed_type01 = array(“image/gif”, “image/pjpeg”, “image/jpeg”, “image/png”, “image/x-png”, “image/jpg”);
$do_thumb = 1; /
1 make thumbnails; 0 means do NOT make /
$thumbDir = “/home/users/web/b109/ipg.removalspacecom/images/thumbs”; /
thumbnail folder /
if(!is_dir($thumbDir)) echo “2. Directory Doesn’t Exist: $thumbDir
”;
$thumb_prefix = “”; /
prefix for thumbnails /
$thumb_width = 90; /
max thumb width /
$thumb_height = 70; // max thumb height
//Writes the photo to the server
if(move_uploaded_file($_FILES[‘upload’][‘tmp_name’], $target)) {
/
HERE IS WHERE WE WILL DO THE ACTUAL RESIZING /
/
THESE SIX PARAMETERS MAY BE CHANGED TO SUIT YOUR NEEDS /
$upload = $_FILES[‘upload’][‘name’];
$o_path =“images/COMPANIES/”;
if(!is_dir($o_path)) echo “3. Directory Doesn’t Exist: $o_path
”;
$s_path = “images/thumbs/”;
if(!is_dir($s_path)) echo “4. Directory Doesn’t Exist: $s_path
”;
$file = $upload;
$save = $file;
$t_w = 200;
$t_h = 150;
/
DO NOT CHANGE THIS NEXT LINE */

  Resize_Image($save,$file,$t_w,$t_h,$s_path,$o_path);

}else{
//Gives and error if its not
$error_message .= “Sorry, there was a problem uploading your file.”;
}}
exit(0);
?>[/php]

Once again, replace the entire View02.php file with this code and then submit the form from View01.php - thanks!

Okay here’s what happens now:

POST:
Array
(
)
FILES:
Array
(
)
REQUEST:
Array
(
[id] => 81
[website] =>
[phone] =>
[phone2] =>
[premiumuser_description] =>
[upload] => wavingsanta360.jpg
[Submit] => submit
[eucookie] => eucookie
[PHPSESSID] => 3db01d94b217734f9d65c3bbd871196e
[__utmb] => 95372959.6.10.1348509880
)

OK, that is extremely weird.

One more thing: hopefully…[php]<?php
echo ‘PHP VERSION: ‘.phpversion().’

’;

foreach($GLOBALS as $k=>$v) echo “$k
”;
?>[/php]

You can save this one as any file name and you can just view it directly (without submitting the form).

hmmmm?

PHP VERSION: 5.2.17

GLOBALS
_ENV
HTTP_ENV_VARS
PATH
SCRIPT_NAME
REQUEST_METHOD
HTTP_ACCEPT
SCRIPT_FILENAME
SERVER_SOFTWARE
REMOTE_PORT
HTTP_USER_AGENT
HTTP_ACCEPT_LANGUAGE
GATEWAY_INTERFACE
DOCUMENT_ROOT
REMOTE_HOST
UNIQUE_ID
SERVER_NAME
SERVER_ADMIN
HTTP_ACCEPT_ENCODING
HTTP_CONNECTION
HTTP_ACCEPT_CHARSET
SERVER_PORT
HTTP_COOKIE
REMOTE_ADDR
SERVER_PROTOCOL
REQUEST_URI
HTTP_HOST
TZ
eucookie
PHPSESSID
__utmb
PHP_SELF
REQUEST_TIME
argv
argc
_POST
HTTP_POST_VARS
_GET
HTTP_GET_VARS
_COOKIE
HTTP_COOKIE_VARS
_SERVER
HTTP_SERVER_VARS
_FILES
HTTP_POST_FILES
_REQUEST
v
k

Well, I’ll pretty much guarantee that the problem is with View01.php now. Go ahead and replace View02.php with this:[php]<?php
echo ‘

’;
print_r($_POST);
print_r($_FILES);

/* check if form was submitted /
if (isset($_POST[‘Submit’])){
$error_message = “”;
/
This is the directory where images will be saved /
$target = “/home/users/web/b109/ipg.removalspacecom/images/COMPANIES/”;
if(!is_dir($target)) echo “1. Directory Doesn’t Exist: $target
”;
$target = $target . basename( $_FILES[‘upload’][‘name’]);
/
include validation script /
// include (‘php only scripts/validation.php’);
$uploadDir = ‘/home/users/web/b109/ipg.removalspacecom/images/COMPANIES’; /
main picture folder /
$max_height = 450; /
largest height you allowed; 0 means any /
$max_width = 450; /
largest width you allowed; 0 means any /
$max_file = 2000000; /
set the max file size in bytes /
$image_overwrite = 1; /
0 means overwite; 1 means new name /
/
add or delete allowed image types /
$allowed_type01 = array(“image/gif”, “image/pjpeg”, “image/jpeg”, “image/png”, “image/x-png”, “image/jpg”);
$do_thumb = 1; /
1 make thumbnails; 0 means do NOT make /
$thumbDir = “/home/users/web/b109/ipg.removalspacecom/images/thumbs”; /
thumbnail folder /
if(!is_dir($thumbDir)) echo “2. Directory Doesn’t Exist: $thumbDir
”;
$thumb_prefix = “”; /
prefix for thumbnails /
$thumb_width = 90; /
max thumb width /
$thumb_height = 70; // max thumb height
//Writes the photo to the server
if(move_uploaded_file($_FILES[‘upload’][‘tmp_name’], $target)) {
/
HERE IS WHERE WE WILL DO THE ACTUAL RESIZING /
/
THESE SIX PARAMETERS MAY BE CHANGED TO SUIT YOUR NEEDS /
$upload = $_FILES[‘upload’][‘name’];
$o_path =“images/COMPANIES/”;
if(!is_dir($o_path)) echo “3. Directory Doesn’t Exist: $o_path
”;
$s_path = “images/thumbs/”;
if(!is_dir($s_path)) echo “4. Directory Doesn’t Exist: $s_path
”;
$file = $upload;
$save = $file;
$t_w = 200;
$t_h = 150;
/
DO NOT CHANGE THIS NEXT LINE */

  Resize_Image($save,$file,$t_w,$t_h,$s_path,$o_path);

}else{
//Gives and error if its not
$error_message .= “Sorry, there was a problem uploading your file.”;
}}
exit(0);
?>[/php]

I’d leave the first couple of lines until we have everything working. I’m not sure what all is going on with View01.php (its a mess) but I’ll try to work through it as soon as possible. In the meantime, lets replace it with this, just to confirm that this is where the problem lies:[code]

My Form Website:
Primary Number:
Secondary Number:
Company Description:
Upload your company image here:
[/code]

Also, make sure that the action contains the proper name for your view02.php file (whichever way you are doing the “V”).

Fingers crossed…

Thanks so far btw.

i changed view01.php to just a plain form. It has the correct v, view02.php for the action.

The view02.php has been edited.

Here’s the outcome:

Array
(
[website] =>
[phone] =>
[phone2] =>
[premiumuser_description] =>
[upload] => wavingsanta360.jpg
[submit] => submit
)
Array
(
)

OK, when I stripped out most of the stuff I screwed up the form encoding. We need to use this instead:[code]

My Form Website:
Primary Number:
Secondary Number:
Company Description:
Upload your company image here:
[/code]

Sorry to keep making little changes. I cannot test any of this right now, so I keep seeing things that I would normally have caught in testing before posting…

S’ok, all will help to get to why it’s not working.

Changed that now and had to change the “v” to lower-case.

the results changed now, not sure if it’s what your expecting but:

Array
(
[website] =>
[phone] =>
[phone2] =>
[premiumuser_description] =>
[submit] => submit
)
Array
(
[upload] => Array
(
[name] => wavingsanta360.jpg
[type] => image/jpeg
[tmp_name] => /tmp/phpKbGFsX
[error] => 0
[size] => 18694
)

)

Looks like its getting a temp name and reading file size ready for the re-size and drop into the thumbs folder.

Any news on this one?

Just going through the whole thread again trying to iron out creases. I dont think $row is conflicting? I have added the validation.php script below if it helps?:

[code]<?PHP

/* validate company name /
if((!isset($_POST[‘company_name’])) || (strlen(trim($_POST[‘company_name’])) <5) || (trim($_POST[‘company_name’]) !=
preg_replace("/[^a-zA-Z0-9\s-’,._&’]/", “”,
trim($_POST[‘company_name’])))) {
/
if username is bad start building the error message /
$error_message .= “You must enter a valid company name
”;
$error_message .= “Valid names are min 5 characters and use letters, numbers and underscores only.
”;
$error_message .=“Your invalid company name was: <font color=“red”>” . $_POST[‘company_name’] . “


”;
}
/
END validating company_name */

/* validate contact name /
if((!isset($_POST[‘contact_name’])) || (strlen(trim($_POST[‘contact_name’])) <5) || (trim($_POST[‘contact_name’]) !=
preg_replace("/[^a-zA-Z0-9\s-’,._&]/", “”,
trim($_POST[‘contact_name’])))) {
/
if username is bad start building the error message /
$error_message .= “You must enter a valid contact name
”;
$error_message .= “Valid names are min 5 characters and use letters only.
”;
$error_message .= “Your invalid contact name was: <font color=“red”>” . $_POST[‘contact_name’] . “


”;
}
/
END validating contact_name */

/* validate phone number /
$phone = ‘000000000000, 00000 000000’;
if((!isset($_POST[‘phone’])) || (strlen(trim($_POST[‘phone’])) <5) || (trim($_POST[‘phone’]) != preg_replace("/[^0-9\s-_]/", “”, trim($_POST[‘phone’])))) {
/
if it is NOT set, then set the error variable and start building the error message */
$error_message .= “You must enter a valid phone
”;
$error_message .= “Valid phones are min 11 numbers only.
”;
$error_message .= “Your invalid phone was: <font color=“red”>” . $_POST[‘phone’] . “


”;

}
/* END validating phone */

/* validating the email /
if(!isset($_POST[‘email’]) || validateEmailAddress($_POST[‘email’]) !=1) {
$error_message .= “You must enter a valid email address
”;
$error_message .= “The invalid email was: <font color=“red”>” . $_POST[‘email’] . “


”;
}
/
END validating email */

/* validate street1 /
if((!isset($_POST[‘street1’])) || (strlen(trim($_POST[‘street1’])) <5) || (trim($_POST[‘street1’]) != preg_replace("/[^a-zA-Z0-9\s-’,._]/", “”, trim($_POST[‘street1’])))) {
/
if username is bad start building the error message /
$error_message .= “You must enter a valid address
”;
$error_message .= “Your invalid name was: <font color=“red”>” . $_POST[‘street1’] . “


”;
}
/
END validating street1 */

/* validate username /
if((!isset($_POST[‘username’])) || (strlen(trim($_POST[‘username’])) <5) || (trim($_POST[‘username’]) != preg_replace("/[^a-zA-Z0-9_]/", “”, trim($_POST[‘username’])))) {
/
if username is bad start building the error message /
$error_message .= “You must enter a valid username
”;
$error_message .= “Valid usernames are min 5 characters and use letters, numbers and underscores only.
”;
$error_message .= “Your invalid name was: <font color=“red”>” . $_POST[‘username’] . “


”;
}
/
END validating username */

/* validate password /
if((!isset($_POST[‘password’])) || (strlen(trim($_POST[‘password’])) <5) || (trim($_POST[‘password’]) != preg_replace("/[^a-zA-Z0-9_]/", “”, trim($_POST[‘password’])))) {
/
if it is NOT set, then set the error variable and start building the error message /
$error_message .= “You must enter a valid password
”;
$error_message .= “Valid passwords are min 5 characters and use letters, numbers and underscores only.
”;
$error_message .= “Your invalid password was: <font color=“red”>” . $_POST[‘password’] . “


”;
}else{
$password = trim($_POST[‘password’]);
}
/
END validating password */

/* check to see if username is already taken */
$username = mysql_real_escape_string(trim($_POST[‘username’]));

$query1 = “SELECT username from companies WHERE username = ‘$username’”;
$result1 = mysql_query($query1) or die(mysql_error());
$count = mysql_num_rows($result1);
if($count>0) {
$error_message .= “The username: <font color=“red”>” . $_POST[‘username’] . " is taken.


";
}

?>
[/code]

:o just tested other parts of the form and nothing is being updated now :frowning:

if (isset($_POST[‘Submit’])){ <<< does that need to be somewhere else or is it good there? just making sure.

Thanks!

Sponsor our Newsletter | Privacy Policy | Terms of Service