0

hi.
i have a html form that allows user to browse and upload the code using the upload button ( which runs php). the files gets uploaded. now i need to either change that existing php file or add a new button in html file and compile and run the code that was uploaded and display its result.

the project is to develop online app. that can take the c++ code of students and upload it and allow uploded code to compile and run.

<?php
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"] . " <br />";

  echo "<p /><p />SOURCE: ".$_FILES["file"]["tmp_name"]."<br />";
  echo "DEST: "."/var/www/C275/tmp/"."TESTFILENAME"."<br /><p />";

  $success = move_uploaded_file($_FILES["file"]["tmp_name"] ,
                                         "/var/www/C275/tmp/" . "TESTFILENAME");

  if($success)
    echo "Success<br />";
  else
    echo "FAILURE! <br />";

  }
?>

Edited by pritaeas: Changed to discussion thread.

3
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by diafol
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.