Попробуйте этот сохранить и получить данные изображения как.
var image_uploader = new plupload.Uploader({
runtimes: 'html5,flash,html4',
browse_button: "image_uploader",
container: "image_upload_container",
url: base_url + 'Blog/upload_files',
chunk_size: '1mb',
unique_names: true,
multi_selection: false,
resize: {
width: 300,
height: 300
},
flash_swf_url: base_url + 'assets/js/plupload/js/Moxie.swf',
silverlight_xap_url: base_url + 'assets/js/plupload/js/Moxie.xap',
filters: {
max_file_size: '10mb',
mime_types: [
{title: "Image files", extensions: "jpg,jpeg,png,pdf"}
]
},
init: {
FilesAdded: function (up, files) {
setTimeout(function () {
up.start();
}, 1);
},
FileUploaded: function (up, file) {
$("#image_div").html('<div class="form-group col-sm-6 col-md-offset-3 text-right">\n\
<a href="javascript:;" onclick="remove_photo2()">\n\
<i class="fa fa-2x fa-times-circle"></i></a>\n\
<div class="form-group text-left"><input type="hidden" name="image" value="' + file.target_name + '">\n\
<img alt="" class="img img-responsive" src="' + base_url + 'uploads/' + file.target_name + '" height="100" width="100"/></div></div>');
$("#image").val(file.target_name);
},
},
UploadComplete: function () {
// $('#image_div').unblock();
},
Error: function (up, err) {
// $('#image_div').unblock();
bootbox.alert(err.message);
}
});
image_uploader.init();
function remove_photo2(id) {
$("#image_div").empty();
}
//php
<!-- begin snippet: js hide: false console: true babel: false -->
<div class="fileinput fileinput-new row mt-3" data-provides="fileinput" >
<div id="og_image_div">
<div class="form-group">
<?php if (isset($blog_data['og_image'])) { ?>
<input class="form" type="hidden" name="og_image" id="og_image" value="<?php echo isset($blog_data['og_image']) ? $blog_data['og_image'] : ''; ?>">
<img src="<?php
if ($blog_data['og_image'] != '' && file_exists(FCPATH . 'uploads/blog/' . $blog_data['og_image'])) {
echo base_url('uploads/blog/' . $blog_data['og_image']);
} else {
echo base_url() . '';
}
?>" height="70px" width="100px"/>
<?php } ?>
<!--<input class="form" type="hidden" name="image" id="image">-->
</div>
</div>
</div>