Labvakar visiem, kā pareizi nododas bilde.
HTML
<input type="file" id="filename" class="filename" />
JS
var filename = $("#filename").val();
$.ajax({
type: 'POST',
url: '/news/attachPost',
data: { filename : filename},
dataType: "json",
success: function(msg){
if(msg.error){
$('#errorAttach').fadeIn(1000, function (){
$('#errorAttach').html(msg.error);
});
return;
}
alert(msg.image);
}
});
POST pieņem viss kārtībā
PHP
$image = $_POST[''filename"];
Ir iespēja dabūt tā?
$image = $_FILES["filename"];