无法使用php将文件上传到S3

时间:2016-03-03 22:24:03

标签: php amazon-web-services heroku amazon-s3

我在2个月前在s3上安装了php,但是几天之后它似乎已经不再适用了。

当我继续登录时,我收到此错误:

PHP fatal error: Internal Zend error - Missing class information for in /app/GuzzleHttp/Psr7/Stream.php on line 11

我正在使用此sdk https://github.com/aws/aws-sdk-php/releases,这就是我使用它的方式:

    <?php



include 'functions.php';
require_once 'BusinessLogic/SimpleImage.php';
require_once 'BusinessLogic/Manager.php';
require 'aws-autoloader.php';

use BusinessLogic\SimpleImage;
use BusinessLogic\Manager;


sec_session_start(); 

$bucket = 'mybucketname';

$s3 = Aws\S3\S3Client::factory(array(
    'region' => 'eu-central-1',
    'version' => 'latest',
    )
);

if(!Manager::loginCheck()){
     header("Location: login.php");
}else {

    if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_FILES['file']) && $_FILES['file']['error'] == UPLOAD_ERR_OK && is_uploaded_file($_FILES['file']['tmp_name'])) {
        $s3->upload($bucket, $_FILES['file']['name'], fopen($_FILES['file']['tmp_name'], 'rb'), 'public-read');
        $tempFile = "http://".$bucket.".s3.amazonaws.com/".$_FILES['file']['name'];          //3

    }


    //



}
?>     

0 个答案:

没有答案