{"id":28125148,"url":"https://github.com/xing/paperclip-storage-ftp","last_synced_at":"2025-05-14T09:20:44.148Z","repository":{"id":4812203,"uuid":"5965834","full_name":"xing/paperclip-storage-ftp","owner":"xing","description":"Allow Paperclip attachments to be stored on FTP servers","archived":false,"fork":false,"pushed_at":"2018-06-21T14:19:38.000Z","size":2471,"stargazers_count":54,"open_issues_count":0,"forks_count":15,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-04-19T08:16:58.087Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xing.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-09-26T13:01:11.000Z","updated_at":"2025-01-18T12:00:53.000Z","dependencies_parsed_at":"2022-09-13T17:51:37.638Z","dependency_job_id":null,"html_url":"https://github.com/xing/paperclip-storage-ftp","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xing%2Fpaperclip-storage-ftp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xing%2Fpaperclip-storage-ftp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xing%2Fpaperclip-storage-ftp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xing%2Fpaperclip-storage-ftp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xing","download_url":"https://codeload.github.com/xing/paperclip-storage-ftp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254110399,"owners_count":22016394,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-14T09:20:24.832Z","updated_at":"2025-05-14T09:20:44.137Z","avatar_url":"https://github.com/xing.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FTP Storage for Paperclip\n\nAllow [Paperclip](https://github.com/thoughtbot/paperclip) attachments\nto be stored on FTP servers.\n\n## Status\n\n[![Build Status](https://secure.travis-ci.org/xing/paperclip-storage-ftp.png)](http://travis-ci.org/xing/paperclip-storage-ftp)\n[![Coverage Status](https://coveralls.io/repos/xing/paperclip-storage-ftp/badge.png?branch=master)](https://coveralls.io/r/xing/paperclip-storage-ftp?branch=master)\n[![Gem Version](https://badge.fury.io/rb/paperclip-storage-ftp.png)](http://badge.fury.io/rb/paperclip-storage-ftp)\n\n## Installation\n\nAdd this line to your application's `Gemfile`:\n\n```ruby\ngem \"paperclip-storage-ftp\"\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it manually:\n\n    $ gem install paperclip-storage-ftp\n\n## Usage\n\nSomewhere in your code:\n\n```ruby\nrequire \"paperclip/storage/ftp\"\n```\n\nIn your model:\n\n```ruby\nclass User \u003c ActiveRecord::Base\n  has_attached_file :avatar, {\n    # Choose the FTP storage backend\n    :storage =\u003e :ftp,\n\n    # Set where to store the file on the FTP server(s).\n    # This supports Paperclip::Interpolations.\n    :path =\u003e \"/path_on_ftp_server/:attachment/:id/:style/:filename\",\n\n    # The full URL of where the attachment is publicly accessible.\n    # This supports Paperclip::Interpolations.\n    :url =\u003e \"/url_prefix/:attachment/:id/:style/:filename\",\n\n    # The list of FTP servers to use\n    :ftp_servers =\u003e [\n      {\n        :host     =\u003e \"ftp1.example.com\",\n        :user     =\u003e \"foo\",\n        :password =\u003e \"bar\"\n      },\n      # Add more servers if needed\n      {\n        :host     =\u003e \"ftp2.example.com\",\n        :user     =\u003e \"foo\",\n        :password =\u003e \"bar\",\n        :port     =\u003e 2121, # optional, 21 by default\n        :passive  =\u003e true  # optional, false by default\n      }\n    ],\n\n    # Optional socket connect timeout (in seconds).\n    # This only limits the connection phase, once connected\n    # this option is of no more use.\n    :ftp_connect_timeout =\u003e 5, # optional, nil by default (OS default timeout)\n\n    # Optional flag to skip dead servers.\n    # If set to true and the connection to a particular server cannot be\n    # established, the connection error will be ignored and the files will\n    # not be uploaded to that server.\n    # If set to false and the connection to a particular server cannot be established,\n    # a SystemCallError will be raised (Errno::ETIMEDOUT, Errno::ENETUNREACH, etc.).\n    :ftp_ignore_failing_connections =\u003e true, # optional, false by default\n\n    # Optional flag to keep empty parent directories when deleting files.\n    :ftp_keep_empty_directories =\u003e true # optional, false by default\n  }\nend\n```\n\n## Changelog\n\n### 1.2.8\n\n* Handle possible ftp error when uploading to empty remote dir [#28](https://github.com/xing/paperclip-storage-ftp/pull/28)\n\n### 1.2.7\n\n* Reduce number of FTP commands for creating directories [#27](https://github.com/xing/paperclip-storage-ftp/pull/27)\n\n### 1.2.6\n\n* New option `:ftp_keep_empty_directories` to disable the removal of empty parent directories when deleting files (introduced in 1.2.2). See usage example above.\n* Fix missing log lines in logjam. This only affects apps that use [logjam_agent](https://github.com/skaes/logjam_agent).\n\n### 1.2.5\n\n* Ignore ftp error when deleting an non-existing file [#29](https://github.com/xing/paperclip-storage-ftp/pull/29)\n\n### 1.2.4\n\n* Avoid unnecessary connection to server(s) when there are no files to be written or deleted [#26](https://github.com/xing/paperclip-storage-ftp/pull/26)\n\n### 1.2.3\n\n* Rescue FTPPermError exception during `file_exists?` [#22](https://github.com/xing/paperclip-storage-ftp/pull/22)\n\n### 1.2.2\n\n* Remove empty parent directories after image deletion [#21](https://github.com/xing/paperclip-storage-ftp/pull/21)\n\n### 1.2.1\n\n* Raise `Paperclip::Storage::Ftp::NoServerAvailable` error when using `:ftp_ignore_failing_connections =\u003e true` but all servers are down\n* Avoid connecting to all servers for operations that just need one\n\n### 1.2.0\n\n* New options `:ftp_connect_timeout` and `:ftp_ignore_failing_connections`. See usage example above.\n\n### 1.1.0\n\nMostly performance enhancements\n\n* Use one thread per server to upload assets to multiple servers in parallel [#10](https://github.com/xing/paperclip-storage-ftp/issues/10)\n* Avoid excessive reconnects to reduce overall upload time\n* Close connnection immediately after being used\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Added some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n\n## Authors\n\n* [Sebastian Röbke](https://github.com/boosty)\n* and other friendly [contributors](https://github.com/xing/paperclip-storage-ftp/graphs/contributors)\n\nYou can find out more about our work on our [dev blog](http://devblog.xing.com).\n\nCopyright (c) 2015 [XING AG](http://www.xing.com)\n\nReleased under the MIT license. For full details see [LICENSE](https://github.com/xing/paperclip-storage-ftp/blob/master/LICENSE)\nincluded in this distribution.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxing%2Fpaperclip-storage-ftp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxing%2Fpaperclip-storage-ftp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxing%2Fpaperclip-storage-ftp/lists"}