What is the problem?
When I add a file using my form the $_POST variables are undefined. When I don’t add a file the $_POST variables are defined.
What errors do you receive?
Notice: Undefined index: bbmpin in C:\...\addpin.php on line 6
Notice: Undefined index: usermsg in C:\...\addpin.php on line 7
Source Code
index.html
<form method="POST" action="addpin.php" enctype="multipart/form-data">
<div>
<label for="bbmpin">Your BBM Pin</label>
<input type="text" name="bbmpin" placeholder="Enter Your BBM Pin">
</div>
<div>
<label for="usermsg">Message</label>
<input type="text" name="usermsg" placeholder="(optional) Add a short message" maxlength="255">
</div>
<div>
<label for="image">Upload Image <small>(optional)</small></label>
<input type="file" name="image">
</div>
<button type="submit">Submit</button>
</form>
addpin.php
<?php
session_start();
require_once('config/config.php');
$pin = $_POST['bbmpin'];
$msg = $_POST['usermsg'];
$ip = $_SERVER['REMOTE_ADDR'];
print_r($_POST);
print_r($_FILES);
exit;
...
?>
If the post size exceeds the allowed maximum, the $_POST superglobal array will be empty.
So you have to check if file upload suceeds be checking the $_FILES array or checking the $_POST array.
http://www.php.net/manual/en/features.file-upload.errors.php
If you need to increase the post size limit, you should check this php.ini directive
http://www.php.net/manual/en/ini.core.php#ini.post-max-size
And maybe you will need to change it in your web server configuration (I don’t know which one do you use)