Question

i accessing google cloud storage by blobstore api, I would like to generate file names automatically instead of create it in the server. actually i want to do that, because it is hard to me to create a unique file name every time the user upload file. thank you

Était-ce utile?

La solution

If you are using Python you can simply use UUID to generate your random filenames like this:

import uuid

...

# with dashes
filename = uuid.uuid4()

# or without dashhes
filename = uuid.uuid4().hex

Autres conseils

You can generate an organised file name simply by just by using either computer name and Internet clock time, with a Smart-Phone you can use GPS day time year and map coordinates like in the case of geotagging. Everything is unique and readily available on computer or mobile rather than leaving a server to name the file.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top