php接收文件流

PHP接收文件流代码如下  :

[php]
<?php
$base_path = "../UPFILE/"; //接收文件目录
$target_path = $base_path .  date("Ymdhms")."".basename ( $_FILES [‘uploadfile’] [‘name’]  ); //在文件名称前面加上当前日期时分秒
if (move_uploaded_file ( $_FILES [‘uploadfile’] [‘tmp_name’], $target_path )) {
$array = array ("code" => "1", "message" => $_FILES [‘uploadfile’] [‘name’] );
echo json_encode ( $array );
} else {
$array = array ("code" => "0", "message" => "There was an error uploading the file, please try again!" . $_FILES [‘uploadfile’] [‘error’] );
echo json_encode ( $array );
}
?>
[/php]

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注