问题描述:

We have create a system for a client which is like Vine. The front-end is using Angular and the back-end is using a REST-API built using Laravel. We are storing the vidoes/pictures on Google Storage. Most of the users are located in the Israel and some of them are using hebrew language on their pc's or mobile phones. The problem is when a user uploads a video with a hebrew/arabic file names. I know Laravel has localization but how do I approach this during file uploads.

The upload is very straight-forward and using the laravel's filesystem. Do I translate the video filename to english first? or just convert all video file names to a random name?

网友答案:

I'd suggest to convert filenames to something like:

auth()->user()->id.'-'.time().'.jpg'

With this approach, you'll always get unique filename.

Another approach is to create separate folder for each user and create filenames based on last inserted ID.

相关阅读:
Top