duanhuanyou6478 2016-03-03 22:24
浏览 39

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

I had setup upload with php on s3 2 months ago but by a few days it seems that it isn't working anymore.

When I go on log I get this error:

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

I am using this sdk https://github.com/aws/aws-sdk-php/releases and this is how I'm using it:

    <?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条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 测距传感器数据手册i2c
    • ¥15 RPA正常跑,cmd输入cookies跑不出来
    • ¥15 求帮我调试一下freefem代码
    • ¥15 matlab代码解决,怎么运行
    • ¥15 R语言Rstudio突然无法启动
    • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
    • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
    • ¥15 用windows做服务的同志有吗
    • ¥60 求一个简单的网页(标签-安全|关键词-上传)
    • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法