i am getting an error in uploading image into folder. there is an error occured during uploading that image. my Controller Code is (cakeplus is my root folder ex: htpp://localhost/cakeplus) :
$directory = "http://".$_SERVER['HTTP_HOST'].'/cakeplus/pics'; if(!is_dir($directory)) { mkdir($directory,0777); } $files_array = $this->data['Photo']['path']; //pr($files_array); die; if(isset($files_array['name']) && $files_array['name']!='') { $filetype = $files_array['type']; $filesize = $files_array['size']; $filename = $files_array['name']; $filetmpname = $files_array['tmp_name']; $file_type = explode('.',$filename); $ext_name = array_reverse($file_type); $final_file_title = $ext_name[1]; $file_name = Inflector::slug( str_replace( ".".$ext_name[0], "" , $filename ). '_' .time() ,'-' ); $newFileName = $file_name.'.'.$ext_name[0]; move_uploaded_file($filetmpname, $directory.'/'.$newFileName); $requirementuploadData['Photo']['path'] = $file_name; $this->Photo->create(); $this->Photo->save($requirementuploadData,false); } Error(s)(Warnings) :
Warning (2): move_uploaded_file(http://localhost/cakeplus/pics/wallpaper-1433586197.png): failed to open stream: HTTP wrapper does not support writeable connections [APP\Controller\PhotosController.php, line 31] Warning (2): move_uploaded_file() [function.move-uploaded-file]: Unable to move 'C:\xampp\tmp\phpA80D.tmp' to 'http://localhost/cakeplus/pics/wallpaper-1433586197.png' [APP\Controller\Photos