I'm trying to use PHP file upload in Codeigniter controller. It's not working... I'd like it to be done without Codeigniter library...
Move uploaded file function is not working..
$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
}
}
}
}
Don't know what's wrong with move_file_uploaded().
</div>