Rusty
Rusty

Reputation: 4473

Efficient way to upload images in a post for a blog?

I was wondering a method to upload images in the posts of a blog. I am thinking of two ways:- 1) To create a row in the database for imageurl and use this url to point to the image stored on the local disk. 2) Is there a way to upload images directly to mysql???

Upvotes: 0

Views: 95

Answers (1)

MD Singh
MD Singh

Reputation: 1455

You could use BLOB to store image directly in your database, But it makes your database heavy and usually all hosting services put a limit on database sizes.

I faced the same issue a while back and after some research i found out that The best way is to store it your file system and store its url in your database.

If you only have one folder, you don't need to store the whole URL just the file name and append the domain when displaying it.

Hope its help. :)

Upvotes: 3

Related Questions