我试图在Codeigniter控制器中使用PHP文件上传。它没有工作......我希望没有Codeigniter库就可以完成...
移动上传的文件功能无效..
$ destination - outputs:
"http://localhost/canvera/album_images/56cd8fe89bbcc.jpg"
$images["tmp_name"][$i] --- outputs:
C:\xampp\tmp\php57EC.tmp
$images=$_FILES['images'];
$files_count=count($images["name"]); //get no files selected
$allowed_ext=array("jpg",
"jpeg",
"png",
"gif",
"bmp"); // Allowed file extensions
for($i=0;
$i < $files_count;
$i++) {
$tmp=explode(".", $images["name"][$i]);
$file_ext=strtolower(end($tmp));
//
if(in_array($file_ext, $allowed_ext)) {
if($images["size"][$i] < 7340032) {
$file_on_server=uniqid().".". $file_ext;
// echo $file_on_server; exit;
$destination=base_url()."album_images/". $file_on_server;
if(move_uploaded_file($images["tmp_name"][$i], $destination)) {
$image_data=array("album_id"=> $album_id, "name_on_server"=> $file_on_server, "filename"=> $images["name"][$i]);
if($this->photobook->save_image($image_data)) {
$uploaded++; // no of files uploaded
}
}
else {
$not_uploaded++; // no of files not uploaded
}
}
}
}
&#13;
不知道move_file_uploaded()有什么问题。