'php Blob url to directory
throught ajax send a blob url
var blob = new Blob([content], { type: 'text/html; charset=utf-8' });
var urlBlob = URL.createObjectURL(blob);
$.ajax({
url: url,
data: {
'blob': urlBlob
},
type: 'POST',
dataType: 'json',
success: function (data) {
alert("ok");
}
, error: function () {
alert('error');
}
});
in php i read this string blob:http://localhost:8888/4eca0076-33c8-42ab-bd96-11055dcf800f
now i'd like to save in a dir.... I tried
$file = fopen($filepath, "w");
fwrite($file, base64_decode($blob));
fclose($file);
OR
move_uploaded_file(base64_decode($blob), $filepath);
but write a strange characters
file_put_contents($filepath, base64_decode($blob));
don't works
do you ha ve idea?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|