如何将用户照片大量上传到MySQL数据库
我正在使用使用PHP和MySQL的用户管理系统。(XAMPP) 它在名为“用户”的表中具有大约1000多种用户记录,其中“ ID”为主要键。 其中一列是“头像” 我有一个带有1000多个JPG图像的文件夹。所有用户图像均由其ID命名。例如,如果一个名为jon的用户ID = 222他的照片将为222.jpg
我要做的就是使用图像名称将所有照片上传到表格中的正确用户ID,
什么是最好的方法可以接受吗? 希望它清楚并提前感谢
I'm working on a user management system that uses PHP and mysql.(XAMPP)
it has around 1000+ user records in A table called "users" with "id" as primary key.
one of the columns is "avatar"
I have a folder with 1000+ jpg images. all user images are named by their ids. for example if a user named Jon with id=222 his photo will be 222.jpg
what I want to do is upload all photos to their users using the image name to be put to the correct user id in the table
what's the best approach I can take?
hope its clear and thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我有一些您可能会执行的步骤:
照常上传文件,但是在此步骤中,您必须将用户ID作为参数
包含
重命名文件之前,请先保存图像,示例:
将其上传到文件夹
保存到您的表格
I have some steps that you might do :
Upload file as usual, but in this step you must include user id as parameter
Query user by id
Rename file before save image, example :
Upload it to folder
Save to your table