pdf file not uploaded in phpmyadmin?

Course Queries Syllabus Queries 2 years ago

0 1 0 0 0 tuteeHUB earn credit +10 pts

5 Star Rating 1 Rating

Posted on 16 Aug 2022, this text provides information on Syllabus Queries related to Course Queries. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Answers (1)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 2 years ago


hello everyone this is my piece of code to upload the pdf file,file is not being uploaded to path i have given plz help me out in database its shows the entry but in the path where pdf file should be there it does not exist...

php
    // Check if a file has been uploaded
    if(isset($_FILES['uploaded_file'])) {
        // Make sure the file was sent without errors
        if($_FILES['uploaded_file']['error'] == 0) {
            // Connect to the database
            $dbLink = new href="https://forum.tuteehub.com/tag/mysql">mysqli('localhost', 'root', '', 'college');
            if(href="https://forum.tuteehub.com/tag/mysql">mysqli_connect_errno()) {
                die("MySQL connection failed: ". href="https://forum.tuteehub.com/tag/mysql">mysqli_connect_error());
            }

            // Gather all required data
            $id1 = $dbLink->real_escape_string($_FILES['uploaded_file']['down_id']);
            $id2 = $dbLink->real_escape_string($_FILES['uploaded_file']['course_id']);
            $data = $dbLink->real_escape_string(file_get_contents($_FILES  ['uploaded_file']['tmp_name']));
            move_uploaded_file($data,"/upload/syllabus/");
            $myhref="https://forum.tuteehub.com/tag/path">path="upload/syllabus/";
            $type = intval($_FILES['uploaded_file']['down_type']);

            // Create the SQL query
            $query = "
                INSERT INTO `download_master` (
                    `down_id`, `course_id`, `down_title`, `href="https://forum.tuteehub.com/tag/path">path`
                )
                VALUES (
                    '{$id1}', '{$id2}', {$type}, '{$myhref="https://forum.tuteehub.com/tag/path">path}'
                )";

            // Execute the query
            $result = $dbLink->query($query);

            // Check if it was successfull
            if($result) {
                echo 'Success! Your file was successfully added!';
            }
            else {
                echo 'Error! Failed to insert the file'
                   . "
{$dbLink->error}
"
; } } else { echo 'An error accured while the file was being uploaded. ' . 'Error code: '. intval($_FILES['uploaded_file']['error']); } // Close the href="https://forum.tuteehub.com/tag/mysql">mysql connection $dbLink->close(); } else { echo 'Error! A file was not sent!'; } // Echo a link back to the main href="https://forum.tuteehub.com/tag/page">page echo '

Click href="index.php">here to go back

'
; ?>

No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.