Hello,

I am trying to write the server side component of a file uploading form,
which worked fine in its previous version with nothing to do with zend.
(using move_uploaded_file, rather than rename())

At this point, the front end is done and posts files as expected, the php
code:

  public function imageuploadAction()
  {
   if ($this->getRequest()->isPost())
   {
    $uploadAdapter = new Zend_File_Transfer_Adapter_Http(); // TODO: change
to Zend_File_Transfer when the factory is stable
    $resourcePath = APPLICATION_PATH .
Zend_Registry::get('config')->resourcepath . "/images";
    if (!is_dir($resourcePath))
    {
     throw new Exception('Savepath not found in config.ini or it isnt a
directory: ' . $resourcePath);
    }

    $uploadAdapter->addFilter('Rename', $resourcePath);
    if (!$uploadAdapter->receive())
    {
     $messages = $uploadAdapter->getMessages();
     echo implode('<br />', $messages); die;
     //throw new Infinite_Exception_SystemError('receive returned false');
    }
    echo "redirect to edit screen"; die;
   }
  }

Results in the file ending up in the appropriate location at the end,
however it results in the output:


*Warning*:
rename(/var/tmp/AccessibleMarshal.dll,/usr/home/share/webdocs/tnagel/project/application/resources/images/filename.jpg)
[function.rename <http://formalcars.tnagel/ad/imageupload/function.rename>]:
Operation not permitted in *
/usr/home/share/webdocs/tnagel/project/library/Zend/Filter/File/Rename.php*on
line
*206*
redirect to edit screen

The resource directory is world writable.

It does seem 'safe' to ignore the warning, I assume move_uploaded_file is
where the file is getting copied rather than rename?


Tim

Reply via email to