Upload and store an image in the Database with PHP

Uploading and storing an image in a database using PHP is a common task in web development. By storing images directly in the database, you can easily manage, retrieve, and manipulate image data alongside other relevant information. This simplifies data backup and recovery processes and ensures data integrity.

In this article, I will show you 3 approaches to accomplish this –
1. Storing image files by saving their file path or name,
2. Encoding images as base64, and
3. Storing images as BLOB (Binary Large Object) data.

Additionally, we will delve into the retrieval process to display the uploaded images from the database.

By the end of this article, you will have a better understanding of various techniques to upload images to a database and retrieve them for display on your web application.

Upload and store an image in the Database with PHP

Read more

Login page with Remember me in PHP

Remember me option allows the user to automatically get logged in to the website without entering its username and password again.

To do this I am using $_COOKIE that store value on the client-side for detecting the user. Next time when the user comes it will automatically redirect to the homepage.

Encrypt the value before storing it to $_COOKIE and decrypt it while access. It will automatically destroy after 30 days.

Login page with Remember me in PHP

Read more