Paweł,
Perhaps I'm misunderstanding, but I'm guessing you won't be able to do this
because Zend Framework does not model the file system.  At my company, our
platform used to use MogileFS, but we transitioned to POSIX-compatible file
storage; we recommend OCFS2 to our clients now.

(Side note: I would really recommend transitioning away from MogileFS if you
can, because it has some significant drawbacks, not the least of which is
its poor performance, especially under high load.)

Anyway, we had to abstract out file system access such that we could have a
POSIX adapter or a MogileFS adapter (for backwards compatibility).  Zend
Framework should do something similar, and in fact I may propose something
to that effect at some point.  Zend Framework can approach this in a few
different ways: modeling an individual file (Zend_File_Interface), which is
good for OO; modeling a file system (Zend_File_System_Interface), which is
better for performance; or do both, and let the user decide which is
appropriate.

-Matt

2008/12/9 Paweł Chuchmała <[EMAIL PROTECTED]>

> I have questions ho implement some methods.
>
> I want to send file to MogileFs system. I write adapter for it. Scnario is:
>
> 1. receive file via user form (http_adapter::receive())
> 2. add file to my adapter: $file->addFile($form->file->getFileName());
> 3. add filters: $file->addFilter('Rename', '/something\c:\veryStrange/');
> 4. send it to MogileFs: $file->send().
>
> I write send() method and first question: should I apply filters before
> send?
> Another problem. File in MogileFS are stored in flat structure. There
> are'nt directories, filenames, etc. I can't use
> method Zend_File_Transfer_Adapter_Abstract::_filter(), because it use
> dirname() and filename() to choose destination and name.
> I cant use Zend_Filter_File_Rename, cause it work on files in system. If I
> receive file it's ok. But if I want send it somewhere,
> I want to change only array that describe my file.
>
> Filenames (for true I should say 'virtual filenames') in MogileFs nad
> Amazon S3 can be like point 3. above, so if I want send file to them,
> shouldn't be validated as file for store in 'traditional' file systems.
>
> How I can do this, in Zend Framework convention?
>
> regards,
> pch
>
>
>
> 2008/12/9 Thomas Weidner <[EMAIL PROTECTED]>
>
> There are always 2 directions.
>> Upload and Download.
>>
>> Upload means that the server receives a file from a foreign destination.
>> Therefor the method is called receive.
>> Download means that the server sends a file to a foreign destination.
>> Therefor the method is called send.
>>
>> When you don't want to send a file to the client you can still echo it
>> (display), but this is no download.
>> Zend_File_Transfer does only handle file transfer and not file displaying
>> needs.
>>
>> Beside that the FTP adapter is not coded for now so there is no need to
>> hassle about it. :-)
>>
>> Greetings
>> Thomas Weidner, I18N Team Leader, Zend Framework
>> http://www.thomasweidner.com
>>
>> ----- Original Message ----- From: "Paweł Chuchmała" <
>> [EMAIL PROTECTED]>
>> To: <[email protected]>
>> Sent: Tuesday, December 09, 2008 10:43 AM
>> Subject: [fw-general] Zend_File_Transfer proposal, send and receive
>>
>>
>>
>>  Hi.
>>>
>>> I don't understand when I should use send() and receive() methods.
>>> I think that send() should send file(s) from place where our application
>>> is
>>> to another place.
>>> And receive() should receive file to place where application is.
>>> For example, if I want store at ftp server file from user uploaded by
>>> http
>>> post, I do it like that:
>>>
>>> $form->file->receive();
>>>
>>> $files = new Zend_File_Transfer('FTP', array('user' => 'adam', 'pwd' =>
>>> 'sandler', 'server' => 
>>> 'ftp.myserver.com/public')<http://ftp.myserver.com/public%27%29>
>>> );
>>> $files->addFiles($form->file->getFileName)
>>>  ->send();
>>>
>>> But in examples from proposal we have:
>>> FTP Download:
>>> "The API can also be used for downloads. It will work as wrapper so the
>>> user
>>> does not see where the original files is located and ZF will send the
>>> file
>>> to the user."
>>> and it use send(). I think it should use receive() to receive file from
>>> ftp,
>>> and then send it to user by echoing content or something else, but nod
>>> send() method from FTP adapter.
>>>
>>> Kind, regards,
>>> pch
>>>
>>> --
>>> Paweł Chuchmała
>>> pawel.chuchmala at gmail dot com
>>>
>>>
>>
>
>
> --
> Paweł Chuchmała
> pawel.chuchmala at gmail dot com
>

Reply via email to