+ cerbere_die("Add in your data posted or in the URL mode=file to read data from the file posted (one file per api call) or mode=request to read data from \$_REQUEST['data'].");
+
+ case 'request':
+ $data = $_REQUEST['data'];
+ $format = "raw";
+ break;
+
+ case 'file':
+ $file = $_FILES['datafile']['tmp_name'] or cerbere_die("File is missing");
+ if (!is_uploaded_file($file)) cerbere_die("Invalid form request");
+ $data = "";
+ if (ereg('\.tar$', $file)) {
+ $format = "tar";
+ $data = file_get_contents($file);
+ } elseif (ereg('\.tar\.bz2$', $file)) {
+ $format = "tar";
+ } elseif (ereg('\.bz2$', $file)) {
+ $format = "raw";
+ } else {
+ $format = "raw";
+ $data = file_get_contents($file);
+ }
+ if ($data === "") {
+ //.bz2
+ $bz = bzopen($file, "r") or cerbere_die("Couldn't open $file");