您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

PHP-postman上传图片到服务器

2025/5/17 21:33:30发布20次查看
这次的这篇文章介绍的是关于php-postman上传图片到服务器的内容,现在分享给大家,有需要的小伙伴可以参考一下
1. postman的设置:
2. php代码:public function byte(){     $base_path = ./uploads/; //存放目录     if(!is_dir($base_path)){         mkdir($base_path,0777,true);     }     $target_path = $base_path . basename ( $_files ['upload'] ['name'] );     if (move_uploaded_file ( $_files ['upload'] ['tmp_name'], $target_path )) {         $info['mess'] = 'ok';         //$info['flag'] = 0;         exit(json_encode($info));     } else {         $array = array (             flag => 0,             mess => there was an error uploading the file, please try again! . $_files ['upload'] ['error']         );         exit(json_encode ( $array ));     } }
3. api说明:请求方式参数是否必须参数说明
post upload y 所要上传的文件
相关推荐:
postman上传图片到服务器方法
以上就是php-postman上传图片到服务器的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product