我试图在我的控制器中测试一个方法.... 我可以通过浏览器提供输入,使用REQUEST类型来获取我的值.... 是否可以提供文件路径以及其他键值对... 我试图给出文件路径,但它没有存储... 继承我的代码......
$profilepic = $_FILES['logo']['name'];
$logintype=$_REQUEST['logintype'];
if(!empty($profilepic))
{
$imagepath = pathinfo($profilepic);
$pic=date('YmdHis').'.'.$imagepath['extension'];
$config['upload_path'] = './user_images/';
$config['allowed_types'] = 'gif|jpg|jpeg|png';
$config['max_size'] = '0';
$config['max_width'] = '0';
$config['max_height'] = '0';
$config['file_name'] = $pic;
$this->load->library('upload', $config);
if ($this->upload->do_upload('logo'))
{
$upload_data = $this->upload->data();
$profilepicture=$upload_data['file_name'];
$this->load->model('user_model');
$results = $this->user_model->NewSignUp($logintype,$profilepicture);
}
}
else
{
$message = array('message'=>"provide values","logintype"=>$logintype,"image"=>"empty image");
echo json_encode($message);
我尝试将值传递为
url: baseurl / folder / controller / method?logintype = 0& logo = C:\ Users \ php-04 \ Pictures \ tulips.jpg
我总是得到回应:
{"message":"provide values","logintype":"0","image":"empty image"}
答案 0 :(得分:0)
你的意思是?
$profilepicturePath = $upload_data['full_path'];