FTPStorage: saving large files + more robust exists()

Issue #4 resolved
Wim Leers created an issue

This patch has been created as part of my bachelor thesis [1] – as part of the daemon I wrote. I'm using django-storages to send files to FTP, Amazon S3 and Amazon CloudFront.

This patch is for FTPStorage and it does two things:

It enables the saving of large files by no longer reading all the chunks of the file in a single string, instead it uses ftplib.storbinary() directly with a file pointer, which then handles the writing in chunks automatically.

It makes exists() more reliable: it's been tested with 3 different FTP servers and so far it works without problems (PureFTPd, Xlight FTP Server 3.2 (used by http://simplecdn.com) and Pure-FTPd (used by http://rambla.be)).

This greatly improves the number of use cases where you can use the FTPStorage custom storage system.

[1] http://wimleers.com/tags/bachelor-thesis

Comments (3)

  1. David Larlet repo owner

    I applied the two modifications, let me know if it's still working for you and I'll close the issue.

  2. Log in to comment