I want to post some data using PHP forms
. For this I have created a form as follow :
<form method="post" action="uploadimage.php" id="FileUploader" enctype="multipart/form-data">
<div class="control-group">
<label class="control-label" for="file">Upload Image</label>
<div class="controls">
<input type="text" id="Fifle" name="name" />
<input type="file" id="File" name="mFile" />
</div>
</div>
<input type="submit" class="btn btn-info" name="submit" value="Upload" />
</form>
in uploadimage.php
I am writing :
<?php
$UploadDirectory = 'upload/'; //Upload Directory, ends with slash & make sure folder exist
$MySql_username = "root"; //mysql username
$MySql_password = ""; //mysql password
$MySql_hostname = "localhost"; //hostname
$MySql_databasename = 'mydb'; //databasename
if (!@file_exists($UploadDirectory)) {
//destination folder does not exist
die("Make sure Upload directory exist!");
}
print_r($_POST);
But when I am trying to post it is returning Array ( )
Please guys help me what I am doing wrong ?
var_dump
and you'll see posted file details.
var_dump($_FILES['mFile']);
array (size=5)
'name' => string 'test.jpg' (length=41)
'type' => string 'image/jpeg' (length=10)
'tmp_name' => string 'C:\wamp\tmp\php335.tmp' (length=22)
'error' => int 0
'size' => int 29678
Get it echo $_FILES['mFile']['name'];