Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8379617
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:14:17+00:00 2026-06-09T16:14:17+00:00

Been stumbling around the net having a difficulty finding a sample of getting a

  • 0

Been stumbling around the net having a difficulty finding a sample of getting a file path of a browsed file. Some of them I read that this function no longer works anymore due to security reasons. Any ideas guys? I badly need a sample. I already tried many times.

This is currently I have:

<html>

<body>


<form method="post" action="file.php" enctype="multipart/form-data">

<input type="radio" name="type" value="moodle" required="required" /> Moodle<br />
<input type="radio" name="type" value="bb" required="required" /> BlackBoard<br />
<input type="file" name="file" id="file" /><br /><br />

<input type="submit" value="Submit" name="submit" />

</form> 

</body>

</html>

the file.php

<?php


$filetype = $_POST["type"];




echo $filetype;

echo "Upload: " . $_FILES['file']['name'] . "<br />";
echo "Type: " . $_FILES['file']['tmp_name'];

if ($_FILES['file']['error'] > 0)
  {
  echo "Error: " . $_FILES["file"]["error"] . "<br />";
  }
else
  {
  echo "Upload: " . $_FILES['file']['name'] . "<br />";
  echo "Type: " . $_FILES['file']['type'] . "<br />";
  echo "Size: " . ($_FILES['file']['size'] / 1024) . " Kb<br />";
  echo "Stored in: " . $_FILES['file']['tmp_name'];
  }


function moodlezip($zipfile){

    echo "<h1>MOODLE</h1>"."<br />";

    $moodle = new Moodle();
    $zip = zip_open($zipfile);
    $ziparc = new ZipArchive;


    if ($zip)
    {
        while ($zip_entry = zip_read($zip))
        {

            $file = zip_entry_name($zip_entry);

            //echo "Name: " . $file . "<br />";


            if (strpos($file,'course.xml') !== false) {

                if ($ziparc->open($zipfile) === TRUE) {

                    $coursexml =  new SimpleXMLElement($ziparc->getFromName($file));

                    $moodle->getCourse($coursexml);

                    $ziparc->close();


                } else {
                    echo 'failed';
                }


            }

            else if (strpos($file,'forum.xml') !== false) {

                if ($ziparc->open($zipfile) === TRUE) {

                    $topicxml =  new SimpleXMLElement($ziparc->getFromName($file));

                    $moodle->getTopic($topicxml);

                    $ziparc->close();


                } else {
                    echo 'failed';
                }


            }



            else if (strpos($file,'lesson.xml') !== false) {

                if ($ziparc->open($zipfile) === TRUE) {

                    $lessonxml =  new SimpleXMLElement($ziparc->getFromName($file));

                    $moodle->getLessons($lessonxml);

                    $ziparc->close();


                } else {
                    echo 'failed';
                }


            }



            else if (strpos($file,'quiz.xml') !== false) {

                if ($ziparc->open($zipfile) === TRUE) {

                    $quizxml =  new SimpleXMLElement($ziparc->getFromName($file));

                    $moodle->getQuizzes($quizxml);

                    $ziparc->close();


                } else {
                    echo 'failed';
                }


            }


            else if (strpos($file,'questions.xml') !== false) {

                if ($ziparc->open($zipfile) === TRUE) {

                    $questionsxml =  new SimpleXMLElement($ziparc->getFromName($file));

                    $moodle->getQuestions($questionsxml);

                    $ziparc->close();


                } else {
                    echo 'failed';
                }


            }


        }

        zip_close($zip);
    }

}

require_once 'classes/backup.php';

$connect = mysql_connect("localhost","root","");


if (!$connect)
{
    die('Could not connect: ' . mysql_error());
}

mysql_close($connect);


//form upload loop folders input submit, find, bb, scorm
//class admin
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T16:14:18+00:00Added an answer on June 9, 2026 at 4:14 pm

    Use pathinfo() http://php.net/manual/en/function.pathinfo.php

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Maybe its because I've been coding around two semesters now, but the major stumbling
I've been trying to setup my first rails app--I'm okay at stumbling around on
I've been working through some objective-c/ iOS dev books and I've hit a stumbling
I have been stumbling through some different steps to do this. I ran the
Been stuck on this for ages. Currently learning Django and done some bits on
Been looking around and can't find a definite way to do this... I need
Been stumbling me for over an hour now and that means time to ask
I have been using jQuery for some time and this one's stumping me- I
I've been stumbling upon Objective-J. It should be a superset of JavaScript ... but
I have been stumbling over this problem for a while now. I am trying

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.