views:

17

answers:

1

Right now i am storing files inside public directory in my application.

I want to upload file to specific path like http://uploadfacility.com.

I have a login and password for that specific path.

http://uploadfacility.com/test?username=test1&password=test1

How may i store files to specific path outside my application.

I need to modify :storage or anything else ??

A: 

You need to create a new module (referred as 'backend' in the plugin), Technoweenie::AttachmentFu::Backends.const_get('YourChosenBackend').

The contract for this backend is, i am afraid, implicitly defined in other backend modules. You can refer to s3, file_system or db. By contract I mean that there are some methods that you need to override / define. A few examples (i took them from file_sysyem_backend.rb:

full_filename(thumbnail = nil)                                                                                                                                         
base_path                                                                                                                                                              
attachment_path_id                                                                                                                                                     
partitioned_path(*args)                                                                                                                                                
public_filename(thumbnail = nil)                                                                                                                                       
filename=(value)                                                                                                                                                       
create_temp_file                                                                                                                                                       
destroy_file                                                                                                                                                           
rename_file                                                                                                                                                            
save_to_storage                                                                                                                                                        
current_data

Once you have defined your backend, you can then pass the option :storage => :your_chosen to has_attachment.

Swanand