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: <fw-general@lists.zend.com>
> 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