Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于图片上传的问题 #9

Open
chlinwei opened this issue Apr 28, 2019 · 1 comment
Open

关于图片上传的问题 #9

chlinwei opened this issue Apr 28, 2019 · 1 comment

Comments

@chlinwei
Copy link

你写的代码图片上传分为两个步骤:
1.先把文件上传到文件服务器中
2.再把文件的url保存到数据库中
此时就有个很难解决的问题,如果第一个步骤成功,第二个步骤失败,此时文件服务器上就会多出一张图片?这个咋办呢?

@zhyocean
Copy link
Owner

zhyocean commented May 8, 2019

那就只有第二步保存到数据库需要返回一个是否成功的标志了,如果保存url到数据库失败就需要删除文件服务器上的图片,但是我目前的操作因为图片是按照时间戳命名存放,所有失败操作的图片还是会在服务器上

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants