它有点疯狂,发生在我的Ubuntu操作系统上。
尝试使用以下脚本上传文件,它在上传文件夹中创建一个零字节的文件,不确定是否出错。有人可以看看。
这是我的附加脚本
代码:
// App Config
$app_dir = '.';
$uploaddir = $app_dir . '/uploads/';
$filetype = 'text/xml';
if ( isset($_POST['uploadbtn'] ) ){
// Upload a file
print_r( $_FILES );
if ( !isset($_FILES['file1']['name']) || $_FILES['file1']['name'] == '' ) {
echo 'No files uploaded, Pls upload a file';
exit;
}
//print_r ( $_FILES );
$filename = basename( $_FILES['file1']['name'] );
$uploadfile = $uploaddir . $filename ;
if ($_FILES['file1']['type'] != $filetype ) {
echo 'Sorry, your file was not of the ' . $filetype . ' mimetype (yours was ' . $_FILES['file1']['type'] . ').';
exit;
} // End filetype check
$upload = move_uploaded_file($_FILES['file1']['tmp_name'], $uploadfile );
if ( !$upload ){
echo ' Uploading UNSUCCESSFUL ';
print_r( $_FILES );
} else {
echo ' Uploading Successfulllllllllllllll';
}
}