Welcome Guest, Not a member yet? Register   Sign In
File Upload Error Printing Twice
#1

[eluser]blackhalobender[/eluser]
I have this:

Code:
$data = array('error' => $this->upload->display_errors());

in my controller and this in my view ONCE:

Code:
<?php echo ($_SERVER['REQUEST_METHOD'] == 'POST') ? $error : NULL; ?>
<?php
/// Hack Alert - can't get the default error to go away
if ($error == '<p>Unable to find a post variable called userfile.</p>') {
$error = "";
}
?&gt;
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
&lt;title&gt;Post&lt;/title&gt;
&lt;link rel="stylesheet" href="/css/type.css" type="text/css" media="screen"/&gt;
&lt;link rel="stylesheet" href="/css/style.css" type="text/css" media="screen"/&gt;
&lt;/head&gt;
&lt;body&gt;
<h1>Post New Listing Step 1 of 3: Details</h1>

&lt;?=$this->validation->error_string; ?&gt;
&lt;?=$propertyTypesValidationError; ?&gt;
&lt;?=$error;?&gt;
&lt;!-- Begin Form --&gt;
&lt;?=form_open_multipart("listings/post/$listingType"); ?&gt;

But when I upload something it's prints out the normal error where I have $error below the heading, and also once above everything. Any help?
#2

[eluser]blackhalobender[/eluser]
solved. that's two iv'e solved myself, sorry for wasting your time.

It was this:
Code:
&lt;?php echo ($_SERVER['REQUEST_METHOD'] == 'POST') ? $error : NULL; ?&gt;

Duh. Late night. Sad
#3

[eluser]ejangi[/eluser]
9 times out of 10, if I'm stuck with someone and explain it to someone else, the solutions comes to me. ;-)




Theme © iAndrew 2016 - Forum software by © MyBB