1

我想用我的代码将我的图像上传到亚马逊s3 zend framework

require_once('Zend/Service/Amazon/S3.php'); 
   $awsKey       = 'PRIVATE';
   $awsSecretKey = 'PRIVATE';
   $s3 = new Zend_Service_Amazon_S3($awsKey, $awsSecretKey);
   $a= new Zend_Form_Element_Image('images');
   $bucketName = 'mywebsiteinvietnam';
   $this->view->form = $form;
      if ($this->getRequest()->isPost()) {
        $formData = $this->getRequest()->getPost();
        if ($form->isValid($formData)) {
            $user_name = $form->getValue('user_name');
            $user_email = $form->getValue('user_email');
            //$user_image= $form->getValue('user_image');
            $a = $form->images->receive();
            $posts = new Default_Model_User();
            $perms      = array(Zend_Service_Amazon_S3::S3_ACL_HEADER => Zend_Service_Amazon_S3::S3_ACL_PUBLIC_READ);
            $s3->putFile($a,$bucketName . '/' . $a,$perms);

我的浏览器显示

error: "Cannot read file 1"
(#0 C:\wamp\www\socialnetwork\application\modules\default\controllers\UserController.php(76): Zend_Service_Amazon_S3->putFile(true, 'mywebsiteinviet...', Array))

我正在努力解决....请帮帮我!

4

0 回答 0