0
我想要將文件上傳到文件夾,並將其名稱從Temp.ctp提交到Temp數據庫的tbl_temps表。我已經通過模型文件夾中的名稱創建了模型。但我收到以下內容錯誤:無法找到TempsController.Cake PHP
錯誤:無法找到TempsController.Cake PHP。
錯誤:在文件中創建以下類TempsController:應用程序\控制器\ TempsController.php
temp.ctp
<?php
echo $this->Form->Create("Temp",array("action"=>"temp","enctype"=>"multipart/form-data"));
echo $this->Form->input("file.",array("label"=>false,"div"=>false,"type"=>"file"));
echo $this->Form->input("file.",array("label"=>false,"div"=>false,"type"=>"file"));
?>
<input type="submit"/>
<?php
echo $this->Form->end();
?>
PagesController
<?php
App::uses('AppController', 'Controller');
public $uses = array("Temp");
public function temp(){
if($this->request->is("post")){
$uploaded_files="";
foreach($this->data["Temp"]["file"] as $file1){
$ret_value = $this->PImage->upload($file1,'/app/webroot/files');
if (isset($ret_value[1]) && !empty($ret_value[1])) {
$msgString .= "- File not valid.<br>";
}
else {
if($uploaded_files){
$uploaded_files.= ",*".$ret_value[0];
}
else{
$uploaded_files=$ret_value[0];
}
}
}
$this->request->data["Temp"]["file"]=$uploaded_files;
$this->Temp->save($this->data);
}
}
}