Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Cakephp: How to retrieve video url from Google App Engine

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 1
    • 0
    • 183
    Comment on it

    About Google App Engne

    Google App Engine applications are used to create data storage. We do not require to maintain servers with App Engine. We just need to upload applications and can access the site from the web.

    How to Upload Video? Write the following lines of code to upload video to the Google App Engine storage folder:

    Uploading Video code is:

    require_once 'google/appengine/api/cloud_storage/CloudStorageTools.php';  
    use google\appengine\api\cloud_storage\CloudStorageTools;
    
    $gs_name = $file1['tmp_name'];
    move_uploaded_file($gs_name, 'gs://bucketname/videos/' . $file_name);

    Above code will upload video to the storage folder of google app engine. Now next step is to display video on the web page which is stored in the google app engine storage. Write the following lines of code in order to fetch the video from google app engine storage.

    Code to fetch the video is:

    $storeAt="gs://bucketname/videos/20150225074324830.mp4";
    $options = array('gs'=>array('acl'=>'public-read','Content-Type' =>   $file['type']));
    $ctx = stream_context_create($options);
    $saved = file_put_contents($storeAt, file_get_contents($file['tmp_name']), 0, $ctx);

    All done!. Just don't forget to mark video as Public on google app engine storage folder.  Please have a look on the attached snapshot.

    Cakephp: How to retrieve video url from Google App Engine

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: