why when I upload file in codeigniter, the output it says the temporary folder is missing?
I have already chmod the folder to 777. The source code as shown below. Thank you for the help.
The following is the jquery code the script.
Code:
$(document).ready(function(){
$('#saveDokumenPelanForm').on('submit', function(e){
e.preventDefault();
if($('#dokumenPelan').val() == '')
{
alert("Please Select the File");
}
else
{
$.ajax({
url: BlankonApp.handleBaseURL() + '/InputPembangunan/ajax_upload',
method:"POST",
data:new FormData(this),
contentType: false,
cache: false,
processData:false,
success:function(data)
{
$('#uploaded_image').html(data);
}
});
}
return false;
});
});
Code:
<div class="modal fade" id="addDokumenPelan" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<form id="saveDokumenPelanForm" method="post" enctype="multipart/form-data">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Simpan Fail Pelan Kunci dan Lokasi Tapak</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="form-group row">
<label class="col-md-2 col-form-label">Muat Naik Fail</label>
<div class="col-md-10">
<input type="file" name="dokumenPelan" id="dokumenPelan" class="form-control" required>
<input type="hidden" id="dokumenPelanInputId" name="dokumenPelanInputId" class="form-control " value="{$input_id}">
<input type="hidden" id="dokumenPelanId" name="dokumenPelanId" class="form-control " value="">
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Tutup</button>
<button type="submit" class="btn btn-primary" id="btnSaveDokumenPelan">Muat Naik Fail</button>
</div>
</form>
</div>
</div>
</div>
Code:
function ajax_upload()
{
if(isset($_FILES["dokumenPelan"]["name"]))
{
$config['upload_path'] = './upload/';
$config['allowed_types'] = 'jpg|jpeg|png|gif';
$this->load->library('upload', $config);
if(!$this->upload->do_upload('dokumenPelan'))
{
echo $this->upload->display_errors();
}
else
{
$data = $this->upload->data();
echo 'Name : '.$data["file_name"];
}
}
}