• <tfoot id='QnGhH'></tfoot>

  • <i id='QnGhH'><tr id='QnGhH'><dt id='QnGhH'><q id='QnGhH'><span id='QnGhH'><b id='QnGhH'><form id='QnGhH'><ins id='QnGhH'></ins><ul id='QnGhH'></ul><sub id='QnGhH'></sub></form><legend id='QnGhH'></legend><bdo id='QnGhH'><pre id='QnGhH'><center id='QnGhH'></center></pre></bdo></b><th id='QnGhH'></th></span></q></dt></tr></i><div id='QnGhH'><tfoot id='QnGhH'></tfoot><dl id='QnGhH'><fieldset id='QnGhH'></fieldset></dl></div>

      <bdo id='QnGhH'></bdo><ul id='QnGhH'></ul>

    1. <legend id='QnGhH'><style id='QnGhH'><dir id='QnGhH'><q id='QnGhH'></q></dir></style></legend>

      <small id='QnGhH'></small><noframes id='QnGhH'>

        使用 Zend 框架 1.7.4 上传文件

        时间:2023-10-02

            • <small id='uUuwU'></small><noframes id='uUuwU'>

                <tbody id='uUuwU'></tbody>
                <bdo id='uUuwU'></bdo><ul id='uUuwU'></ul>
                <legend id='uUuwU'><style id='uUuwU'><dir id='uUuwU'><q id='uUuwU'></q></dir></style></legend>

                1. <i id='uUuwU'><tr id='uUuwU'><dt id='uUuwU'><q id='uUuwU'><span id='uUuwU'><b id='uUuwU'><form id='uUuwU'><ins id='uUuwU'></ins><ul id='uUuwU'></ul><sub id='uUuwU'></sub></form><legend id='uUuwU'></legend><bdo id='uUuwU'><pre id='uUuwU'><center id='uUuwU'></center></pre></bdo></b><th id='uUuwU'></th></span></q></dt></tr></i><div id='uUuwU'><tfoot id='uUuwU'></tfoot><dl id='uUuwU'><fieldset id='uUuwU'></fieldset></dl></div>
                2. <tfoot id='uUuwU'></tfoot>
                  本文介绍了使用 Zend 框架 1.7.4 上传文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在尝试使用 Zend Framework 1.7.4 上传文件,但没有成功.我已经阅读了 Akrabat 的教程,这很有帮助,但是当我在我的项目中使用这些技术时,我无法让它工作.

                  I am trying to upload a file using Zend Framework 1.7.4, but have not been successful. I have read Akrabat's tutorial, which was helpful but when i used those techniques in my project I was not able to get it to work.

                  推荐答案

                  您发布的链接只是一般的 Zend Framework 教程,在 ZF 1.5 之后尚未更新.

                  The link you posted is just a general Zend Framework tutorial, and hasn't been updated past ZF 1.5.

                  无论如何,一旦您开始使用 Zend,这是您用来接收上传的代码示例.进行发布的表单必须具有正确的文件上传组件.

                  Anyway, once you get started with Zend, this is a sample of the code you would use to receive an upload. The form doing the posting must have the correct file upload components.

                  //validate file
                  //for example, this checks there is exactly 1 file, it is a jpeg and is less than 512KB
                  $upload = new Zend_File_Transfer_Adapter_Http();
                  $upload->addValidator('Count', false, array('min' =>1, 'max' => 1))
                         ->addValidator('IsImage', false, 'jpeg')
                         ->addValidator('Size', false, array('max' => '512kB'))
                         ->setDestination('/tmp');
                  
                  if (!$upload->isValid()) 
                  {
                      throw new Exception('Bad image data: '.implode(',', $upload->getMessages()));
                  }
                  
                  try {
                          $upload->receive();
                  } 
                  catch (Zend_File_Transfer_Exception $e) 
                  {
                          throw new Exception('Bad image data: '.$e->getMessage());
                  }
                  
                  //then process your file, it's path is found by calling $upload->getFilename()
                  

                  这篇关于使用 Zend 框架 1.7.4 上传文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:Zend 框架,$this->_forward 在做什么 下一篇:什么时候应该使用doctor ORM,什么时候使用zend-d

                  相关文章

                  最新文章

                  <i id='89t7p'><tr id='89t7p'><dt id='89t7p'><q id='89t7p'><span id='89t7p'><b id='89t7p'><form id='89t7p'><ins id='89t7p'></ins><ul id='89t7p'></ul><sub id='89t7p'></sub></form><legend id='89t7p'></legend><bdo id='89t7p'><pre id='89t7p'><center id='89t7p'></center></pre></bdo></b><th id='89t7p'></th></span></q></dt></tr></i><div id='89t7p'><tfoot id='89t7p'></tfoot><dl id='89t7p'><fieldset id='89t7p'></fieldset></dl></div>
                  <tfoot id='89t7p'></tfoot>

                        <bdo id='89t7p'></bdo><ul id='89t7p'></ul>
                    1. <small id='89t7p'></small><noframes id='89t7p'>

                      <legend id='89t7p'><style id='89t7p'><dir id='89t7p'><q id='89t7p'></q></dir></style></legend>