通过zend framework 1将图像上传到亚马逊s3

时间:2013-05-21 09:59:49

标签: zend-framework amazon-s3

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

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))

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

0 个答案:

没有答案