문제

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

도움이 되었습니까?

해결책

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

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top