Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

google cloud storage create file name automatically

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

like image 471
user3376321 Avatar asked Feb 14 '23 15:02

user3376321


1 Answers

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
like image 116
Lipis Avatar answered Apr 28 '23 07:04

Lipis