0

I just can get the temp file path,like D:\XAMPP\tmp\phpE185.tmp...But the $_FILE array is null,because I do a transport from a url to another url.So how to move this temp file?

here is my code:

 class UserController extends Controller
{


public function getRank(){

    echo "waht";
}

public function uploadTrans(Request $request){

    $image = $request->image;
    $name = $request->name;

    $image = urlencode($image);
    $curlPost = "name=$name&image=$image";

    $uploadApi = "http://mdx.ittun.com/authprac/public/upload";
    $ch  = curl_init();
    curl_setopt($ch,CURLOPT_URL,$uploadApi);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch,CURLOPT_POSTFIELDS,$curlPost);
    $output = curl_exec($ch);
    curl_close($ch);
    echo $output;

}
public function upload (Request $request){


    $fileTempName = $request->image;
    print_r($fileTempName);

 //   here I just can get the temp file path..$_FILES array is null
    }
}
vancake
  • 151
  • 1
  • 7

1 Answers1

0

PHP has a move_uploaded_file() function for this purpose.

Since you've tagged your question with , see their docs regarding uploaded files:

$request->file('photo')->move($destinationPath);
Shira
  • 6,392
  • 2
  • 25
  • 27