开发者

how to upload images in a table field in my [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying th开发者_Go百科is question so that it can be reopened, visit the help center. Closed 9 years ago.

Im creating a movie database in mysql. i need to store the images of the movie in a table in single field. pls help me out


Don't store images in your database, just store the references to them (file names or paths). If there will be more than one image per movie, then you will have a table representing this one-to-many relation:

CREATE TABLE movie_images (movie_id int, image varchar(255));

For each image, insert a row:

INSERT INTO movie_images (movie_id, image) VALUES (1, 'preview.png');
INSERT INTO movie_images (movie_id, image) VALUES (1, 'poster.png');
INSERT INTO movie_images (movie_id, image) VALUES (1, 'trailer.png');


you can store the images in the db as BLOB. This might help.

The other way (and my preferred one) would be to store the images in the file system and just store the name or the path of the images as string in the db so that you can fetch it later.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜