PHP returns this warning:
If I don't set the contentType parameter to "multipart/form-data" then the remove PHP script doesn't retrieve the filename at allWarning: Missing boundary in multipart/form-data POST data in Unknown on line 0
The AJAX request using JQuery
Code: Select all
$("#image-add").click(function(ev)
{
var row_thumbnail= $("#row_thumbnail").attr("value");
alert(row_thumbnail); //the filename returned ok
$.ajax(
{
url: "admin-requests.php",
type: "POST",
cache: false,
contentType: "multipart/form-data",
data: "row_thumbnail="+ row_thumbnail,
beforeSend: function(){
//loading...
},
success: function(data){
//success
},
error: function(){
//error
}
});
});
Code: Select all
$row_thumbnail = $_FILES['row_thumbnail'];
echo 'file='.$row_thumbnail;
exit;