Excuse me if my english is not grammatical….
Is it possible to replace $_POST with $_FILES ?
In my program, i copied all information of a register form to an array
Like This
$this->RegistrationFields['profile_img'] = array( 'name' => 'Image','type' => 'BLOB', 'table' => 'users', 'field' => 'profile_img');
and get values using foreach
foreach( $this->RegistrationFields as $fields => $values )
after that it check for field is set or not
if( ! isset( $_POST['register_' . $fields] ) || $_POST['register_' . $fields] == '' )
{
$this->submittedValues[ $fields ] = $_POST['register_' . $fields];
$this->errorLabels['register_' . $fields] = 'error';
$this->errors[] = 'Field ' . $data['name'] . ' cannot be empty';
}
But the problem is that it always shows error message when uploading images,
I guess i have to replace the $_POST with $_FILES while checking image,
SO i put
if ($fields == 'profile_img')
{
//replace $_POST with $_FILES
}
just above the ISSET condition
So my question is :
Is there an inbuld function to replace $_POST with $_FILES???? in *PHP*
EDIT : Or else i could use str_replace?
$_POSTholds data coming from the HTTP POST request to the page.$_FILESholds all data pertaining to a file that’s been uploaded.You can’t swap the two over. If you want to see if a file has been uploaded, try using
Or (better still):
Which will see if there’s been an error uploading the file anywhere.