$newFileName = "download_filename.mp4"; header('Content-Type: video/mp4'); header('Content-Disposition: attachment; filename="' . $newFileName . '"'); $my_aws_key = 'AWS_KEY'; $my_aws_secret_key = 'AWS_SCRET_KEY'; $s3 = new Zend_Service_Amazon_S3($my_aws_key, $my_aws_secret_key); $newFileName = "S3_download_filename.mp4"; $response = $s3->getObjectStream("$newFileName");//download stream from s3 readfile($response->getStreamName());
We are Web Technology Experts Team who provide you Important information on Web Development, Interview Questions and Answers, live project problem and their solution and online free tutorials.
Showing posts with label Amazon. Show all posts
Showing posts with label Amazon. Show all posts
Friday 10 October 2014
Download Videos from Amazon S3 - PHP
Wednesday 14 May 2014
PHP Upload File In Amazon S3 Bucket - Code Snippets
Get List of buckets in Amazon S3 bucket and upload a file in Amazon S3 bucket with Zend Framework.
Uploading files in zend framework is very simple because zend framework provides the API which is very simple to use.
Please use following code to upload photos in zend framework.
$my_aws_key = 'AWS_KEY'; $my_aws_secret_key = 'AWS_SECRET_KEY'; $s3 = new Zend_Service_Amazon_S3($my_aws_key, $my_aws_secret_key); /** Get List of buckets * */ $list = $s3->getBuckets(); foreach ($list as $bucket) { echo "Bucket: $bucket\n"; } /** Get List of buckets * */ /** get Bucket Files **/ $files = $s3->getObjectsByBucket("BUCKET_NAME"); foreach ($files as $file) { echo "File: $file\n"; } /** get Bucket Files **/ $imageName = 'http://static.zend.com/img/yellowpages/ZFCE-logo-XS.jpg'; try { $s3->putFile($imageName, "BUCKET_NAME/ZFCE-logo-XS.jpg", array( Zend_Service_Amazon_S3::S3_ACL_HEADER => Zend_Service_Amazon_S3::S3_ACL_PUBLIC_READ, 'x-amz-storage-class' => 'REDUCED_REDUNDANCY' ) ); die('uploaded successfully'); } catch (Exception $e) { pr($e->getMessage()); die; }
Best Related Posts are Following:
- Zend Framework Remember me login Form.
- How to install Zend Framework 2 in windows.
- How to redirect http to https in Zend Framework.
- Zend framework Disable the layout and Change the Layout in ZF1.
- Zend Framework How to delete a table row from foreach loop.
- Zend framework pagination with array adapter - with code snippets.
- Youtube v3 API Sample API Requests and Response - Search Videos - Get Video Details.
- How to set authorization header in Curl using zend framework.
- How to delete the Zend Cache files from server.
- How to send an email using Email Template in Zend Framework.
- Get Youtube video-details and comments using PHP.
- How to send Attachment in Email in zend framework1 - Send PDF File.
- How to send Email in Zend Framework - HTML Email.
- Send Email from Gmail SMTP using Zend Framework.
- Google trends api php - How to get hot trends.
- Multiple column ordering in Zend Framework.
- Current time zone for a city- Free API.
- Zend Gdata Youtube API - Search Video - View Video Detail.
- Download Videos from Amazon S3 - PHP.
- How to set Cron in Zend Framework.
- Zend Cache Tutorial - Zend Framework 1.12.
- Zend Framework Interview Questions and Answers for Experienced.
- Zend Framework Interview Questions and Answers.
- Zend Framework - Free Google Analytics API.
- Zend_Filter_Input - Zend_Filter - Zend Framework.
- PHP Upload File In Amazon S3 Bucket - Code Snippets.
- Difference Between Zend framework 2 VS Zend framework 1.
- Zend Database Query - Zend Profiler Example - Code Snippets.
Monday 16 September 2013
Amazon S3 Introduction - Basics
Important Terms
S3: Simple Storage Services
AWS: Amazon Web Services
SDK: Software Development Kit
IAM: Identity Access Management
What is AmazonS3
It is Simple Stored Service provided by Amazon where you can manage files and can put authorized on these files.
Amazon will charge only when you upload/download the files. These files can be easily managed through SOAP, HTTP OR with use of third party Services.
Benefits of S3
- Available through API REST/SOAP.
- Durability
- Economic
- Fast
- Scalable
- Web store not FileSystem
Amazon S3 Concepts
Bucket: A Bucket is Amazon terminology for what amounts to a folder or directory of files. Bucket names have to be unique across the service. Its in the root and you can create many bucket as you want. You can places data or directory inside the bucket. You can create 100-150 bucket per account. For each bucket, you can control access to the bucket (who can create, delete, and list objects in the bucket), view access logs for the bucket and its objects, and choose the geographical region where Amazon S3 will store the bucket and its contents.
Bucket Naming Convention
- Can’t have slahes
- It can have lowercase character, number, period(.) and hypen(-)
- Should be between 3-255 characters
- Must be start with number or letter
- Should not have underscore(_)
- Must not be inform of IP (111.233.33.22)
- Must not end with –
- Should not be .- or -. together
Object: When you upload file or folder in the bucket that is known as object. You can also set the permission on that ozbject. To upload folder you must enable “Enable Enhanced Uploader” of java applet. Objects consist of object data and metadata. The data portion is opaque to Amazon S3
Key: It is unique identifier for an object within the bucket. Every object in a bucket has exactly one key. Because the combination of bucket, key and version Id form uniquely object.
For example, in the URL
http://doc.s3.amazonaws.com/2006-03-01/AmazonS3.wsdl,
here "doc" is the name of the bucket and "2006-03-01/AmazonS3.wsdl" is the key
Region: You can choose the geographical Region where Amazon S3 will store the buckets you create. You might choose a Region to optimize latency, minimize costs, or address regulatory requirements.
Features of S3
Reduced Redundancy Storage (RSS): RRS enables customers to reduce their costs by storing non-critical, reproducible data at lower levels of redundancy than Amazon S3's standard storage.
Bucket Policies: Create bucket with permission. An account can grant one application limited read and write access, but allow another to create and delete buckets as well. An account could allow several field offices to store their daily reports in a single bucket, allowing each office to write only to a certain set of names (e.g. "Nevada/*" or "Utah/*") and only from the office's IP address range.
AWS Identity and Access Management :
Create users and groups under your organization's AWS account
Easily share your AWS account resources between the users in the account
Assign unique security credentials to each user
Granularly control users access to services and resources
Get a single AWS bill for all users under the AWS account
Access Control Lists
Versioning
Operations
Create Bucket
Write object in bucket
Read bucket
Delete Object
Listing keys
Amazon S3 API
REST Interface: In REST, you use standard HTTP requests to create, fetch, and delete buckets and objects.
SOAP Interface: The most common way to use SOAP is to download the WSDL (go to http://doc.s3.amazonaws.com/2006-03-01/AmazonS3.wsdl), use a SOAP toolkit such as Apache Axis or Microsoft .NET to create bindings, and then write code that uses the bindings to call Amazon S3
Paying For Amazon S3
You need not to pay in starting and need to choose any plan. Just use as you need and they will charge @ the end of the month.
Subscribe to:
Posts
(
Atom
)