Use it...
In future it will be reworked so that it uses the rename filter but I have not finished my thoughts and it will not be reworked for 1.7 anyway.

If you don't set it, it will use the systems temp path, so there is nothing which you can do wrong.

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

----- Original Message ----- From: "Tim Nagel" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, November 05, 2008 12:15 AM
Subject: Re: [fw-general] Zend_File_Transfer


Thomas,

Thanks for the response. While going through the
Zend_File_Transfer_Adapter_Abstract looking for the appropriate function, I
noticed that setDestination() is depreciated in favour of using a filter.

How do I set the destination path for the adapter if the method is
depreciated? Or, has it not yet been depreciated and I should continue to
use it until such time as the rename filter will deal with this itself?

Or am I missing something else? :-)



Tim

On Mon, Nov 3, 2008 at 18:19, Thomas Weidner <[EMAIL PROTECTED]> wrote:

First the files are uploaded to the destination path using
move_uploaded_file.
This is done in background when you use receive() or any method which calls
receive() in background.
Afterwards the filters are applied, and the file will be renamed.

The warning itself is thrown by php and means that it is not allowed to
move (rename) the file from it's destination directory to the defined
resourcepath.

I think that even if the directory is world wide accessable, there seems to
be a problem with the file permission itself.
You can simply test this out, by not applying the filter and then
rename/move the file from within the same script "manually" from the
destination path to the resourcepath.

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com


----- Original Message ----- From: "Tim Nagel" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Monday, November 03, 2008 1:59 AM
Subject: [fw-general] Zend_File_Transfer


  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