Private files on FTP

Events happening in the community are now at Drupal community events on www.drupal.org.
amitaibu's picture

I wonder if something similar already exists:
I have a site with private download and organic groups. One client (i.e. one group) want's their files on their own server. The solution I'm thinking about is
1) User will upload files to example.com
2) That file will be sent to FTP sitting on the client's server.
3) Alter the links if the files and images to the FTP. Interesting enough, is that the <img> tag can point to an FTP.

  • 'media mover' module can take care of the FTP part, although it might be an overkill for my needs.
  • Some code is needed to deal with imagecache images.

Comments

CurlFtpFS ?

markus_petrux's picture

If you have a dedicated server, then you could mount the FTP site as a local directory using CurlFtpFS.

http://curlftpfs.sourceforge.net/

Then, maybe you could setup the file uploads for that specific group to the mounted FTP filesystem.

Well, it's just an idea. :)

10x markus, I'll look at

amitaibu's picture

10x markus, I'll look at it.
Just to explain a little more - after moving the files to the client's FTP I'll delete the files from my webserver. Also, my webserver will not have/ need read access from the FTP - it will only show FTP links.
The reason is that the client stays in control over his files.

Well, I start to wrote it -

amitaibu's picture

Well, I start to wrote it - and it's already working. I've still got to handle imagecache.
I'll post my findings, probably as a project, when the code is stable.

In the image you can see that the link to the file has been altered and is now the FTP link.

hmm, and the image

amitaibu's picture

hmm, and the image

Might want to take a look at

aaron's picture

Might want to take a look at PHP Stream Wrappers (http://drupal.org/node/227232) and the Resource module (an effort to "backport" that functionality to d6 as part of http://drupal.org/project/media), as part of the Media Code Sprint (http://groups.drupal.org/node/18063).

Aaron Winborn
Drupal Multimedia (book, in October!)
AaronWinborn.com (blog)
Advomatic (work)

Aaron Winborn
Drupal Multimedia (my book, available now!)
AaronWinborn.com
Advomatic

Thank you aaron. I think

amitaibu's picture

Thank you aaron. I think that my use case doesn't require the stream wrappers (unless I missed the point of it), since I don't need to read from the remote server - only to upload the file to the remote server, and remember the filepath there.

The idea of the module is that some people are afraid that their files aren't stored in their own server. So with this module I'm able to serve them through my website, but their file is placed on their FTP.

Stream Wrappers and Resource Module

kwinters's picture

The idea behind using a stream wrapper / "resource" is that you can re-use it in other contexts, like having a WYSIWYG image plugin handle it sensibly. It doesn't matter if it's local or not.

You would be fine implementing it in a different way if you wanted to, but using a stream wrapper will let you easily convert this into a Media / Resource / D7 plugin later.

Ken Winters

PHP Stream Wrappers will do

aaron's picture

PHP Stream Wrappers will do just that. You would implement a stream wrapper to upload the files, and on read, the custom wrapper would simply return the filepath to the remote server. In fact, going forward, it will be the way in Drupal to handle remote files, such as through FTP, S3, or a CDN. Development is close on that; we're planning another code sprint on it next week at DCDC, and you're welcome to be part of that if you'll be attending!

Aaron Winborn
Drupal Multimedia (book, in October!)
AaronWinborn.com (blog)
Advomatic (work)

Aaron Winborn
Drupal Multimedia (my book, available now!)
AaronWinborn.com
Advomatic

I'll sure have a closer look

amitaibu's picture

I'll sure have a closer look in Resources. Won't be in DCDC :(, but thanks for the invitation.

File API

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: