<?php namespace App\Http\Controllers;

use Vimeo\Vimeo;
use Input;
use Validator;
use Redirect;
use Request;
use Session;
use Config;
class UploadController extends Controller {

	/*
	|--------------------------------------------------------------------------
	| Welcome Controller
	|--------------------------------------------------------------------------
	|
	| This controller renders the "marketing page" for the application and
	| is configured to only allow guests. Like most of the other sample
	| controllers, you are free to modify or remove it as you desire.
	|
	*/

	/**
	 * Create a new controller instance.
	 *
	 * @return void
	 */
	public function __construct()
	{
		$this->middleware('auth');
	}

	/**
	 * Show the application welcome screen to the user.
	 *
	 * @return Response
	 */
	public function index()
	{
		ini_set('max_execution_time', 300);
        return view('upload');
    }
   public function upload() 
   {
      ini_set('max_execution_time', 300);
        $client_id      = Config::get('constants.VIMEO_CLIENT_ID');
        $client_secret  = Config::get('constants.VIMEO_SECRET_KEY');
        $access_token   = Config::get('constants.VIMEO_ACCESS_TOKEN');
        $lib            = new \Vimeo\Vimeo($client_id, $client_secret,$access_token);
       $file_path = Input::file('image')->getRealPath();
       
       $uri = $lib->upload($file_path,true);
      // print_r($uri);
	   $lib->request("/videos/127703416");
	       
       exit;
   }
    
    public function getCode()
    {
        
        
    }

}
