Esempio n. 1
0
                 $s->error("Failed to open input stream");
                 return false;
             }
         }
         while ($buff = fread($in, 4096)) {
             fwrite($out, $buff);
         }
         @fclose($out);
         @fclose($in);
         // Check if file has been uploaded
         if (!$chunks || $chunk == $chunks - 1) {
             // Strip the temp .part suffix off
             rename("{$filePath}.part", $filePath);
             colis_on_upload_after($filePath, $profileId);
             $name = basename($filePath);
             if (false !== ($info = colis_get_info($name, $profileId))) {
                 $s->success(['name' => $name, 'info' => $info]);
             }
         }
         if ($chunks && $chunk !== $chunks - 1) {
             die('chunk...');
         }
     } else {
         http_response_code(403);
         $s->error("invalid id");
         return false;
     }
 } else {
     /**
      * Note: if your php.ini's upload_max_filesize or/and post_max_size are too low, 
      * you'll get that message too.
Esempio n. 2
0
<?php

use Tim\TimServer\OpaqueTimServer;
use Tim\TimServer\TimServerInterface;
//------------------------------------------------------------------------------/
// COLIS LING - INFO SERVICE - PROFILES VERSION
//------------------------------------------------------------------------------/
require_once 'inc/colis_init_profiles.php';
// replace this with your application init in prod
OpaqueTimServer::create()->setServiceName('colis.ling_info_profiles')->start(function (TimServerInterface $s) {
    if (isset($_REQUEST["id"])) {
        $profileId = $_REQUEST['id'];
        if (isset($_POST['name'])) {
            $name = $_POST['name'];
            $s->success(colis_get_info($name, $profileId));
        } else {
            $s->error("Invalid input data: missing name");
        }
    } else {
        $s->error("id not set");
    }
})->output();