dongzhila3786 2014-10-13 10:02
浏览 55
已采纳

建议图片路径上传的数据库表

I have a form in which user can upload maximum 5 pictures but its upto the user that how much they upload pictures. If a user does not upload pics so what type of tricks I should apply.

So in this scenario what should i do ? or if i make five columns for every pic and if a user does not upload five pics so the empty columns will take bytes / space. or i should make a dropdown option for storing path.

Kindly do not focus on code it is just to bypass rules.

  • 写回答

2条回答 默认 最新

  • douyue5856 2014-10-13 10:07
    关注

    Adding 5 columns in table is not a desired and valid solution. Think a scenario when user can upload 10 pictures. Then? Will you alter table when your system goes live? No.

    Create a new table called user_file_manager. Add records always in that table and have user reference column. So you can always know that which user has uploaded how many and which files.

    Also just store the image names in the database table and define the image directory path in a configuration PHP file. And use that path in each and every files.

    Hope this helps. Let me know if you want to know anything else.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 c语言数据结构实验单链表的删除
  • ¥15 关于#lua#的问题,请各位专家解答!
  • ¥15 什么设备可以研究OFDM的60GHz毫米波信道模型
  • ¥15 不知道是该怎么引用多个函数片段
  • ¥30 关于用python写支付宝扫码付异步通知收不到的问题
  • ¥50 vue组件中无法正确接收并处理axios请求
  • ¥15 隐藏系统界面pdf的打印、下载按钮
  • ¥15 基于pso参数优化的LightGBM分类模型
  • ¥15 安装Paddleocr时报错无法解决
  • ¥15 python中transformers可以正常下载,但是没有办法使用pipeline