0

I am building a video sharing platform using PHP in which the admin as well as registered users can upload videos. My question is that how should I save the videos in the database? I will be saving the filename of the video in the database and the actual file on the server itself. But I don't want the videos to take up too much space on the server. What is the solution to this problem? How can I make users upload their videos without making the server too heavy?

Prakhar Sood
  • 159
  • 1
  • 10

1 Answers1

0

I don't recommend saving any file to the database, it's much easier to save the filename and then upload the actual file to a folder on your server, you can later retrieve the filename with some php code:

<video src="users/user1/uploads/<?php echo $row['file_name']; ?>">

Refer to this: https://stackoverflow.com/a/17153850/8016771

JeanPaul98
  • 492
  • 6
  • 18
  • Yes I am talking about the same thing. That I would only save the file name or maybe it's directory. But what I am asking is rather than saving the actual file on my server, is there any solution which takes up less space on the server? – Prakhar Sood Sep 06 '17 at 04:39
  • Refer to these two: https://stackoverflow.com/q/11268675/8016771 && https://stackoverflow.com/q/348363/8016771 I think they shall answer your question through and through :) – JeanPaul98 Sep 06 '17 at 04:43