12345678910111213141516171819202122232425262728293031 |
- <?php
- $filename = $_FILES["file"]["name"];
- $temp = explode(".", $filename);
- $csign = $_GET['sign'];
- $time = $_GET['t'];
- $sign = md5( $filename."_lvjunxi_".$time );
- $extension = end($temp); // 获取文件后缀名
- $data = array('code'=>201, 'filename'=>$filename);
- if( $sign != $csign ){
- $data["msg"] = "error sign";
- echo json_encode( $data );
- return;
- }
- if ( $_FILES["file"]["size"] < 409600 && $extension == "pdf"){
- if ($_FILES["file"]["error"] > 0){
- $data["msg"] = "error file";
- echo json_encode( $data );
- }else{
- try{
- $res=move_uploaded_file($_FILES["file"]["tmp_name"], "pdf/".$filename );
- $data["code"] = "200";
- echo json_encode( $data );
- } catch (Exception $e) {
- echo $e->getMessage();
- }
- }
- }else{
- $data["msg"] = "error size";
- echo json_encode( $data );
- }
- ?>
|