PHP-Code:Codeigniter jQuery-Datei-Upload nicht funktioniert
$files = json_decode($this->input->post('Image'));
echo "<pre>";
print_r($files);
echo "</pre>";
jQuery-Code:
var image = [];
for(var i = 1; i <= $("#removeimagefield").attr('data-id'); i++){
image.push($("#imageupload"+i).val());
}
console.log(JSON.stringify(image));
HTML-Code:
<form role="form" enctype="multipart/form-data" accept-charset="utf-8" name="formname" id="formname" method="post" action="">
<input type="file" class="default" id="imageupload1">
</form>
AJAX Funktion:
addproperty = {Image: JSON.stringify(image)}
$.ajax({
method: "POST",
url: formsubmission,
data: addproperty,
async : false,
cache : false,
contentType : false,
processData : false,
success: function(response){
console.log(response);
}
});
Console Nachricht:
["C:\\fakepath\\abhishek.jpg","C:\\fakepath\\krunal.jpg","C:\\fakepath\\nitin.jpg"]
Ich versuche Bilddatei Codeigniter Controller zu laden. aber wenn ich Wert von $ files drucke. als es leeres Array anzeigt.
wo in der Steuerung der Code ist? :/ –