i'm getting an Error after passing php string variable as a javascript function parameter the Error in console logs is
prepare.php:18 Uncaught ReferenceError: uploads is not defined
the code :-
<script src='https://unpkg.com/tesseract.js@v2.1.0/dist/tesseract.min.js'></script>
<script type="text/javascript">
function readfile(stringpath) {
Tesseract.recognize(
stringpath,
'ara',
{ logger: m => console.log(m) }
).then(({ data: { text } }) => {
console.log(text);
const info = ['نقطة الخدمة','رقم العداد','القراءة'];
for(k=0;k<info.length;k++){
var result = text.match(new RegExp(info[k] + '\\s+(\\w+)'))[1];
alert(result);
}
})
};
</script>
<?php
$target_path = "uploads/";
$target_path = $target_path . basename( $_FILES['uploadedFile']['name']);
if(move_uploaded_file($_FILES['uploadedFile']['tmp_name'], $target_path)) {
echo "جاري إضافة الملف ". basename( $_FILES['uploadedFile']['name']).
" إلى جدول ملف إكسل";
echo '<script type="text/javascript">document.write(readfile('.$target_path.'));</script>';
} else{
echo "There was an error uploading the file, please try again!";
}
?>