]> matita.cs.unibo.it Git - logicplayer.git/blob - Server/webApp/prova.php
new initial commit
[logicplayer.git] / Server / webApp / prova.php
1 <?php
2         $target_dir = "esercizi/";
3         $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
4         $uploadOk = 1;
5         $imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
6         // Check if file already exists
7         if (file_exists($target_file)) {
8             echo "Sorry, file already exists.";
9             $uploadOk = 0;
10         }
11         // Check file size
12         if ($_FILES["fileToUpload"]["size"] > 500000) {
13             echo "Sorry, your file is too large.";
14             $uploadOk = 0;
15         }
16         // Check if $uploadOk is set to 0 by an error
17         if ($uploadOk == 0) {
18             echo "Sorry, your file was not uploaded.";
19         // if everything is ok, try to upload file
20         } else {
21             if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
22                 echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded.";
23             } else {
24                 echo "Sorry, there was an error uploading your file.";
25             }
26         }
27         echo exec("php-cli  main.php");
28 ?>
29 <!DOCTYPE html>
30 <html>
31 <head>
32 </head>
33 <body>
34         <form action="upload.php" method="post" enctype="multipart/form-data">
35                 Select file to upload:
36                 <input type="file" name="fileToUpload" id="fileToUpload">
37                 <input type="submit" value="Upload" name="submit">
38         </form>
39 </body>