3

I have a rails app deployed to heroku. I have used paperclipftp to upload files to an ftp server, as heroku doesn't give much features with file uploading. So when I try to upload a file and save a record, I get this error.

Net::FTPPermError (500 I won't open a connection to 10.10...... (only to 174.12........)

I don't know why this is coming up. After some searching I came to know that Heroku doesn't allow active FTP connections so tried to establish a passive connection by editing the paperclipftp file.

I added this line in its initialize block

@ftp.passive = @ftp_credentials[:passive] if @ftp_credentials.has_key?("passive") and passed a variable [passive:true] in my YAML config file. But still it doesn't work.

Please Help. Thanks in advance.

Rohit
  • 5,631
  • 4
  • 31
  • 59
  • How about other file transfer mechanisms? HTTP PUT, SFTP, make it available for download via an HTTP GET request...? – sarnold Feb 28 '11 at 08:50
  • @sarnold I want to upload a file from user and save it on server not download... – Rohit Feb 28 '11 at 10:19
  • ah. If heroku drops FTP and won't support SFTP for you, perhaps then you could re-write your application to support HTTP POST multipart file uploads? – sarnold Feb 28 '11 at 10:31
  • Hey @sarnold I am using multipart HTTP POST for uploading files. See the scenario is, I have an app running on heroku, If a user uploads a file here on heroku's server, I want to take that file and save it on another ftp server. Now what's happening is the file gets uplaoded on heroku's server, and it tries to push the file to the ftp server, and for that it tries to opens an FTP connection, but here I get the above mentioned error `I won't open .....` – Rohit Feb 28 '11 at 10:56

1 Answers1

2

have you found an answer to your problem ? I'm facing the exact same issue and do not know how to bypass this. A solution could be to use Amazon S3 to save your file. I will check in this direction and let you know.

Regards,

Luc

EDIT (28/03/11): S3 is definitively a great solution, very easy to setup. On top of this it's really cheap if you do not have tons of pictures to upload

Luc
  • 16,604
  • 34
  • 121
  • 183
  • Hey @Luc, thanks. I know about the S3, and yes you are right it is easy to implement. But I had a FTP account which was free, so didn't want to invest money with S3. For those who want to go with S3 they can do it. – Rohit May 23 '11 at 06:09
  • @rohit, I use S3 and it offers several Mo for free. – Luc May 23 '11 at 07:25