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

Was it helpful?

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

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top