How Should I Store Uploaded PDF Files on My Website?

0
20
Asked By TechWanderer84 On

I'm working on a website that will allow users to upload PDF files, and I'm trying to figure out the best way to store these files on the server. I've heard that storing files in a database isn't very efficient or scalable, but if I just store them directly on my VPS, I can access them like regular files through the Linux filesystem. However, that feels a bit unsafe. The only other option I've considered is using cloud storage, but I'm not very familiar with it and I've heard some concerning stories about unexpected costs. What should I do?

4 Answers

Answered By CloudGuruDev On

From my experience as a full-stack developer, I'd suggest considering a cloud service for file storage. Azure storage containers, for example, is great because it allows you to manage access and keeps your server space free. Users upload files, which you save in the cloud with a unique ID for retrieval later. This way, you have better control over access, and you can choose to prevent public access entirely.

Answered By CodeCrafter On

It's possible to store files directly in a database, but keep in mind that would typically use more disk space, especially if you're encoding them in base64. Otherwise, accessing them through the filesystem could be more efficient.

Answered By PDFNinja99 On

If you're worried about server security, what exactly doesn't feel safe about storing files directly? There are definitely risks, like potential viruses in PDFs, especially if you're new to handling file uploads. You might want to look into ways to secure your server during the uploads.

Answered By ZipItUp On

One straightforward solution is to compress the PDFs into a zip file before storing them. It can help save space and might make handling the files easier!

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.