]> git.ozlabs.org Git - ccan/blob - web/uploader.php.cpp
tools: use tal/path instead of writing own path handlers.
[ccan] / web / uploader.php.cpp
1 <?php
2 session_start();
3 ?>
4 #include "logo.html"
5 #include "menulist.html"
6 #include "static-configuration"
7 <?php
8
9 // We just email notification for now.  Auto-analysis RSN.
10 if ($_FILES["uploadedfile"]["error"] > 0) {
11   echo "Error: " . $_FILES["uploadedfile"]["error"] . "<br />";
12   exit();
13 }
14
15 $dest = tempnam($tempfolder, "upload-");
16 move_uploaded_file($_FILES["uploadedfile"]["tmp_name"], $dest);
17 umask 0740
18
19 $subject = "CCAN: code upload by '" . $_POST['email'] . "' with name " . $_FILES["uploadedfile"]["name"];
20 $message = "File type: ".$_FILES["uploadedfile"]["type"]."\n".
21         "Size: ".$_FILES["uploadedfile"]["size"]."\n".
22         "Claimed email: ".$_POST['email']."\n".
23         "File destination: ".$dest."\n";
24
25 mail($ccanadmin, $subject, $message, "From: $frommail");
26 echo "<div align=\"center\"> Thanks!<br>
27         Mail will be send to admin to publish the code.<//div>";
28 ?>