Upoad error on Godaddy

I had a script written on fiverr and I am not able to upload files.

Warning: move_uploaded_file(home/j0123rsdrb1/public_html/domain_blacked_out/data/1639245016_Best-Buy-Order-Details—Fulton.pdf): failed to open stream: No such file or directory in /home/j0123rsdrb1/public_html/domain_blacked_out/register.php on line 125

Based on the error message (which could contain abbreviated information), the leading / is missing from the destination path/filename, causing php to treat it as a relative path with respect to the script file, not as an absolute path. What’s the code building the destination path/filename?

                <?php
$allowedfileExtensions = array('pdf', 'gif', 'png', 'txt', 'jpg', 'doc');
$uploadFileDir = ROOT . '/data/';


                    if (!empty($_POST['sbmSave'])) {
                        echo "<hr class=\"my-4\" style=\"background-color:#1E90FF;\" />\r\n";
                        //echo "<pre>" . print_R($_POST,1) . "</pre>";
                        //echo "<pre>" . print_R($_FILES,1) . "</pre>";
                        if (empty($_POST['meeting_date'])) die("empty: meeting_date");
                        if (empty($_FILES['agenda']['name'])) die("empty: agenda file");
                        $agendaFile = $_FILES['agenda'] ;
                        $agenda_packetFile = $_FILES['agenda_packet'] ;
                        $meeting_minutesFile = $_FILES['meeting_minutes'] ;

                        $agendaFilename = "";
                        if (!empty($agendaFile['name'])) {
                            $currentFile = $agendaFile;
                            $imageFileType = strtolower(pathinfo($currentFile["name"],PATHINFO_EXTENSION));
                            if (!in_array($imageFileType, $allowedfileExtensions)) die("invalid file type: " . $imageFileType . "<br>\r\n" . $currentFile["name"]) ;
                            $newFileName = time() . "_" . str_replace(" ","-",$currentFile["name"]);
                            if(move_uploaded_file($currentFile["tmp_name"], $uploadFileDir . $newFileName)){
                                $agendaFilename = $newFileName;
                            } else{
                                die("Upload error: " . $currentFile["name"]);
                            }
                        sleep(1);
                        }


                        $agenda_packetFilename = "";
                        if (!empty($agenda_packetFile['name'])) {
                            $currentFile = $agenda_packetFile;
                            $imageFileType = strtolower(pathinfo($currentFile["name"],PATHINFO_EXTENSION));
                            if (!in_array($imageFileType, $allowedfileExtensions)) die("invalid file type: " . $imageFileType . "<br>\r\n" . $currentFile["name"]) ;
                            $newFileName = time() . "_" . str_replace(" ","-",$currentFile["name"]);
                            if(move_uploaded_file($currentFile["tmp_name"], $uploadFileDir . $newFileName)){
                                $agenda_packetFilename = $newFileName;
                            } else{
                                die("Upload error: " . $currentFile["name"]);
                            }
                        sleep(1);
                        }


                        $meeting_minutesFilename = "";
                        if (!empty($meeting_minutesFile['name'])) {
                            $currentFile = $meeting_minutesFile;
                            $imageFileType = strtolower(pathinfo($currentFile["name"],PATHINFO_EXTENSION));
                            if (!in_array($imageFileType, $allowedfileExtensions)) die("invalid file type: " . $imageFileType . "<br>\r\n" . $currentFile["name"]) ;
                            $newFileName = time() . "_" . str_replace(" ","-",$currentFile["name"]);
                            if(move_uploaded_file($currentFile["tmp_name"], $uploadFileDir . $newFileName)){
                                $meeting_minutesFilename = $newFileName;
                            } else{
                                die("Upload error: " . $currentFile["name"]);
                            }
                        }

                        $meeting_date = $_POST['meeting_date'] ;
                        $status = (!empty($_POST['active'])) ? 1 : 0 ;
                        $committee = $_POST['committee'] ;
                        $notes = $_POST['notes'] ;

                        $committee = $db->escape($committee);$notes = $db->escape($notes);
                        $meeting_dateDB = date("Y-m-d",strtotime($meeting_date));

                        //$exist = $db->get_row("SELECT * FROM meetings WHERE meeting_date='$meeting_dateDB' limit 1 ");
                        //if (!empty($exist)) {
                        //    echo "<div class=\"alert alert-warning\"><strong>Warning</strong> source url <em>$source</em> already submited for type: <em>$type</em> </div>";
                        //} else {

                        //echo("INSERT INTO meetings(meeting_date,agenda,agenda_packet,meeting_minutes,status,committee,notes) VALUES('$meeting_dateDB','$agendaFilename','$agenda_packetFilename','$meeting_minutesFilename','$status','$committee','$notes') ");


                        $db->query("INSERT INTO meetings(meeting_date,agenda,agenda_packet,meeting_minutes,status,committee,notes) VALUES('$meeting_dateDB','$agendaFilename','$agenda_packetFilename','$meeting_minutesFilename','$status','$committee','$notes') ");
                        $lastID = $db->insert_id;
                        echo "<div class=\"alert alert-success\"><strong>Success</strong> created <em>#$lastID</em> </div>";



                        //}


                    }


                ?>
Sponsor our Newsletter | Privacy Policy | Terms of Service