我想使用PHP forms
发布一些数据。为此我创建了一个表单如下:
<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>
我正在写uploadimage.php
中的:
<?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);
但是当我试图发帖时,它正在返回Array ( )
请各位帮助我,我做错了什么?
答案 0 :(得分:0)
var_dump
您将看到已发布的文件详情。
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
获取echo $_FILES['mFile']['name'];