public function testResponse()
 {
     $response = Transloadit::response();
     $this->assertEquals(false, $response);
     $data = array('foo' => 'bar');
     $_POST['transloadit'] = json_encode($data);
     $response = Transloadit::response();
     $this->assertInstanceOf('transloadit\\TransloaditResponse', $response);
     $this->assertEquals($data, $response->data);
     // Can't really test the $_GET['assembly_url'] case because of PHP for now.
 }
 public function redirectUpload()
 {
     sleep(15);
     $response = Transloadit::response();
     if ($response) {
         if (!empty($response->data['results'])) {
             $respon = $response->data['results']['upload'][0];
             $server = $response->data['fields']['server'];
             $tipe = $response->data['fields']['tipe'];
             $file = File::create(['namafile' => $respon['name'], 'size' => $respon['size'], 'url' => $respon['url'], 'server' => $server, 'status' => 0, 'tipe' => $tipe, 'idteam' => Auth::user()->team->id]);
             $job = $this->dispatch(new DownloadFileFromTransloadit($file));
             return redirect('/user/upload')->with('message', 'Upload file berhasil');
         } else {
             return redirect('/user/upload')->with('error', 'Upload gagal, silahkan cek kembali file anda');
         }
     }
     return redirect()->away(Request::url());
 }
/*
### 2. Create a simple end-user upload form

This example shows you how to create a simple transloadit upload form
that redirects back to your site after the upload is done.

Once the script receives the redirect request, the current status for
this assembly is shown using Transloadit::response().

Note: There is no guarantee that the assembly has already finished
executing by the time the `$response` is fetched. You should use
the `notify_url` parameter for this.
*/
// Check if this request is a transloadit redirect_url notification.
// If so fetch the response and output the current assembly status:
$response = Transloadit::response();
if ($response) {
    echo '<h1>Assembly status:</h1>';
    echo '<pre>';
    print_r($response);
    echo '</pre>';
    exit;
}
// This should work on most environments, but you might have to modify
// this for your particular setup.
$redirectUrl = sprintf('http://%s%s', $_SERVER['HTTP_HOST'], $_SERVER['REQUEST_URI']);
// Setup a simple file upload form that resizes an image to 200x100px
echo $transloadit->createAssemblyForm(array('params' => array('steps' => array('resize' => array('robot' => '/image/resize', 'width' => 200, 'height' => 100)), 'redirect_url' => $redirectUrl)));
?>
<h1>Pick an image to resize</h1>
<input name="example_upload" type="file">