upload.php 343 B

1234567891011
  1. <?php
  2. $uplod_path = __DIR__.'/uploads/';
  3. $file_name = $_FILES['file']['name'];
  4. $file_tmp_path = $_FILES['file']['tmp_name'];
  5. $res = move_uploaded_file($file_tmp_path,$uplod_path . $file_name);
  6. if($res){
  7. echo json_encode(['code'=>1,'msg'=>$res,'file'=>$uplod_path . $file_name]);
  8. }else{
  9. echo json_encode(['code'=>0,'msg'=>'error']);
  10. }