开发者

Default mySQl Blob Column or upload an image from server directory

I have this simple problem but I had a hard time of finding a solution. I want my web application to have a default user image upon his registration. My application uploads directly the images to the database in a blob type column and I don't want to use directory uploading. Are there any ways that I can set a default value for blob? or any code that upload an image that came from a server directory to mysql datab开发者_开发百科ase? Thanks


From the Documentation:

BLOB and TEXT columns cannot have DEFAULT values.

Proposed solution:

Why don't you save the file somewhere on your server where it can be served as a static file, and hyperlink that static file instead if your blob column is null?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜