if($_FILES['icon_img']) { $file=file_get_contents($_FILES['icon_img']['tmp_name']); $filename=str_replace('%','',rawurlencode($_FILES['icon_img']['name'])); $filetype=$_FILES['icon_img']['type']; $content = "------neirongqianmianyaoduojialianggegang\r\n". "Content-Disposition: form-data; name=\"purchase_image_file\"; filename=\"$filename\"\r\n". "Content-Type: $filetype\r\n\r\n"; $content.="$file\r\n------neirongqianmianyaoduojialianggegang--\r\n"; $options = array( 'http' => array( 'method' => 'POST', 'header' => "Content-Type: multipart/form-data; boundary=----neirongqianmianyaoduojialianggegang\r\n", 'content' => $content, ) ); $res=json_decode(file_get_contents('http://www.xxx.com/upload', false, stream_context_create($options)),true); }
最新评论: