为什么我的Web应用程序在编辑图像但没有图像时仍然显示错误ERR_CACHE_MISS
?我正在使用Codeigniter。
function edit_produk($id) {
$content['module'] = 'produk' ;
$content['view'] = 'edit_produk_';
$content['id'] = $id;
$this->template->index($content);
}
function edit_produk_() {
$content['status'] = "";
if(isset($_POST['save'])) {
$unique = rand(0000000,999999999);
$unique2 = rand(0000000,999999999);
if($_FILES['gambar']['name'] == ''){
$gambar = '';
}
else {
$gambar = $unique.'.jpg';
}
if($_FILES['gambar2']['name'] == ''){
$gambar2 = '';
}
else {
$gambar2 = $unique2.'.jpg';
}
if($_FILES['gambar']['name'] != ''){
if($_POST['default'] == "") {
$config['upload_path'] = './gambar/';
$config['allowed_types'] = 'jpg|png|jpeg|gif';
$config['max_size'] = '100000'; // 0 = no file size limit
$config['file_name'] = $gambar;
$config['overwrite'] = false;
$this->upload->initialize($config);
$this->load->library('upload', $config);
$this->upload->do_upload('gambar');
}
else {
unlink('./gambar/'.$_POST['default']);
$config['upload_path'] = "./gambar";
$config['max_size'] = '100000'; // 0 = no file size limit
$config['file_name'] = $gambar;
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$this->upload->initialize($config);
if (!$this->upload->do_upload('gambar')) {
echo $this->upload->display_errors('<p>', '</p>');
$gambar = "";
}
}
}
if($_FILES['gambar2']['name'] != ''){
if($_POST['default2'] == "") {
$config['upload_path'] = './gambar/';
$config['allowed_types'] = 'jpg|png|jpeg|gif';
$config['max_size'] = '100000'; // 0 = no file size limit
$config['file_name'] = $gambar2;
$config['overwrite'] = false;
$this->upload->initialize($config);
$this->load->library('upload', $config);
$this->upload->do_upload('gambar2');
}
else {
unlink('./gambar/'.$_POST['default2']);
$config['upload_path'] = "./gambar";
$config['max_size'] = '100000'; // 0 = no file size limit
$config['file_name'] = $gambar2;
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$this->upload->initialize($config);
$this->upload->do_upload('gambar2');
}
}
$kirim = $this->mdl_produk->edit_produk($gambar,$gambar2);
$content['status'] = $kirim;
}
else {
$this->load->view('edit_produk',$content);
}
}
function input_produk($nama,$nama2) {
$data['nama'] = $_POST['nama'];
$data['keterangan'] =$_POST['keterangan'];
$data['harga'] = $_POST['harga'];
$data['kategori'] = $_POST['kategori'];
$data['gambar'] = $nama;
$data['gambar2'] = $nama2;
$query = $this->db->insert('produk', $data);
if($query) {
$kirim = "<div class='alert alert-success alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button>Berhasil Input produk</div>";
}
else {
$kirim ="<div class='alert alert-danger alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button>Gagal Input produk Silahkan Kontak produkistrator</div>";
}
return $kirim;
}
function edit_produk($nama,$nama2) {
$data['nama'] = $_POST['nama'];
$data['id'] = $_POST['id'];
$data['keterangan'] = $_POST['keterangan'];
$data['harga'] = $_POST['harga'];
$data['kategori'] = $_POST['kategori'];
if($nama == "") {
$data['gambar'] = $_POST['default'];
}
else {
$data['gambar'] = $nama;
}
if($nama2 == "") {
$data['gambar2'] = $_POST['default2'];
}
else {
$data['gambar2'] = $nama2;
}
$query = $this->db->query('UPDATE `produk` SET `nama` = "'.$data['nama'].'", keterangan = "'.$data['keterangan'].'", gambar = "'.$data['gambar'].'", gambar2 = "'.$data['gambar2'].'" , harga = "'.$data['harga'].'" , kategori = "'.$data['kategori'].'" WHERE id = "'.$data['id'].'" ');
if($query) {
$kirim = "<div class='alert alert-success alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button>Berhasil Edit produk Untuk Kembali Mengedit Silahkan Klik tombol Kembali Dan Pilih Data Yang Akan Di Edit</div>";
}
else {
$kirim ="<div class='alert alert-danger alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button>Gagal Edit produk Silahkan Kontak produkistrator</div>";
}
return $kirim;
}}
通常,如果编辑成功,它将显示like this。
但是,如果我尝试编辑图像,则编辑成功,但是在浏览器中显示ERR_CACHE_MISS
like this。
答案 0 :(得分:0)
已解决的问题
我尝试重新编码并成功运行
我不知道为什么
谢谢