How to create a blob link in PHP?

0

Hi! Well, I'm creating a video site I'm having a problem playing the videos, I put the videos in mysql and I want to play them, I did not find any way to reproduce them maliciously. The only way I got it was like this: link

Do you know how I can create a link to put in the tag?

Example:

<video src="blob://playex.link/v/2389akjf0-12kjr-1ed22=d123-2sed1"/>
    
asked by anonymous 07.05.2017 / 23:37

1 answer

2

I know it's none of my business, but this in the future when your site grows up will cause you a lot of headaches.

I speak from my own experience, I had problems with this. I saved mysql songs, I know it gave a very tense overload I had to disable the site for 3 days and move everything to files, I lost a lot of users.

If I were you I would save everything in folders, example I have the file wesley.mp4 use the function md5() in it, it will generate a string 4f755db8796988ecf1a3dba1c0cc584d

After this you use a substr('4f755db8796988ecf1a3dba1c0cc584d',0,2); will return 4f.

With this you create a folder called 4f in php there are functions that create the folder if it does not exist. so it would look like this /uploads/4f/wesley.mp4 in this case several files may have 4f at the beginning of md5.

So you can save thousands of files in subfolders that will not get heavy, as I did in the image below.

The first string of the file is always 'a' or '1', it will sort all the strings with 1 or a in this folder, I currently have about 700,000 mp3 files in these folders.

I hope I have helped.

    
08.05.2017 / 09:34