Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

186
Views
concatenate php string to javascript function Parameter

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!";
}
?>


about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!