+ 2

How to store pdf files in database in xampp phpMyAdmin ?

Using blob datatype it is converting file into binary type while downloading the file. I would like to keep it in PDF format itself. So,what can be done? Files are uploaded and retrieved through website using php

18th Mar 2020, 3:20 AM
AKSHAT AGRAWAL
AKSHAT AGRAWAL - avatar
3 Answers
+ 2
What I am doing for now is I store file in specific folder and pass name of it to database. While retrieving, path to the folder will be static as it won't change and you can retrieve names of files from database
18th Mar 2020, 4:18 AM
Raj Chhatrala
Raj Chhatrala - avatar
+ 1
AKSHAT AGRAWAL Storing files in databases is not good idea because your database will be lengthy. What you can do to stores files, you can store files in a folder and that file name in database but remember your file name should be unique otherwise you can't get your actual file while retrieving from the folder. What we do to store files 1 - make a table of sequence and get next sequence while storing files in folder. Why sequence because it generate unique file name like pdf1, pdf2, pdf3 etc 2- make a table for folder location. Why table because maybe you need to change path of folder in future because of less space in drive so we can just update folder path in database and move all old file in new location so in this case no need to make a static path in code. 3- make a table where you want to store your files. 4- while storing files in folder and database at same time just get the next sequence from the table and folder location from the table and make dynamic path like:- /folder_location/pfd1
18th Mar 2020, 9:48 AM
AÍąJ
AÍąJ - avatar
+ 1
hello đŸ”« Rick Grimes Actually i want to create a database for storing question papers class wise and subject wise Also make it available for the users of my website view and download file based on their selection of class and subject. Can you help me out with this how can i achieve it?🙂
20th Mar 2020, 6:21 PM
AKSHAT AGRAWAL
AKSHAT AGRAWAL - avatar