Level 4
Same problem here.
here is my form ''' ''' ajax script for upload ''' var formData = new FormData();
var blobName = clipLabel.textContent+".ogg";
formData.append('audio_blob', blob);
// file name
formData.append('audio_filename',blobName);
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
$.ajax({
url: "{{route('audio')}}",
data: formData,
cache: false,
contentType: false,
processData: false,
type: 'POST',
success: function(response) {
if (response === 'success') {
alert('successfully uploaded recorded blob');
console.log('Successfully Uploaded Recorded Blob');
} else
{
alert(response); // error/failure
}
}
});
}
''' my controller ''' public function audioPost(Request $request){
$data = $request->audio_blob;
$filename = $request->audio_filename;
$path = public_path() . "/uploads/" . $filename;
file_put_contents($path, $data);
} '''
i'm only getting the file in my uploads folder without my data... Since i'm new to Laravel i couldn't figure out the problem. i done this in normal php by using $_POST[audio_blob]. it worked successfully.
Please or to participate in this conversation.