Code Monkey home page Code Monkey logo

Comments (4)

bradleyg avatar bradleyg commented on August 21, 2024

Sorry I somehow missed this message.

S3DIRECT_UNIQUE_RENAME was an old option which was removed at some point. It no longer does anything.

If you want to have unique names you can define a method in settings like this. You then add that method as the first argument of the destination

Yes, you would need to define the saving part yourself unless you are using the Django admin.

from django-s3direct.

johnjwatson avatar johnjwatson commented on August 21, 2024

S3DIRECT_UNIQUE_RENAME was an old option which was removed at some point. It no longer >>does anything.

Yes, I got that now - I checked everything and nothing changed - so, I guessed it does nothing.

If you want to have unique names you can define a method in settings like this. You then add that >>method as the first argument of the destination

Actually, I have done this. Then what I did was went to s3direct/views.py and just added print filename like so:

@require_POST
def get_upload_params(request):
content_type = request.POST['type']
filename = request.POST['name']
print filename
< write to cat_cat DB model here..thats easy>

However, what I see is the original filename always - Is there a way I can get both the original filename and the unique filename (created with uuid as you have shown in def create_filename.)? That would be nice because at the moment all I can seem to get is the original filename within django - and not the unique uuid filename (useful to mapping what is on the S3 server).

p.s: I think there is also a minor cross browser bug in the cat example. So, on firefox, if you upload the file and then refresh(F5) the page, I can still see the REMOVE FILE tag. On Chrome it is fine.

from django-s3direct.

johnjwatson avatar johnjwatson commented on August 21, 2024

So.. is this a real issue? Is is not possible to get both the original filename and unique filename on the django side?

from django-s3direct.

bradleyg avatar bradleyg commented on August 21, 2024

S3Direct doesn't doesn't really deal with any kind of database storage. All it does is upload something to S3 and return that url to the form field you specify.

So in the example:
https://gist.github.com/bradleyg/65852e7d69adacb43574#file-gistfile1-html-L18

It uploads the file and adds the uploaded files URL to the input field with the class name "file-url". You need to decide what's the best way to save that to your database.

Notice there is no action or submit button on the form, that's up to you to implement.

from django-s3direct.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.