即使文件已在服务器上更改,如何在浏览器上显示相同的文件?
我正在服务器上上传一个文件(图像),并使用一个唯一的名称保存它。现在在从服务器获取文件的浏览器上预览它。
现在,我更改了文件(图像),但仅使用以前的唯一名称保存。但是,在预览时,浏览器显示以前的文件。
我发现这是一个cookie问题。因此,在手动从浏览器中删除 cookie 后,我能够看到新文件。
I am uploading a file(Image) on the server, and saving it with one unique name. Now previewing it on the browser where file fetched from the server.
Now, I changed the file(image), but save with that previous unique name only. But, while previewing it, browser is showing previous file.
I figured it out as a cookie problem. So after deleting cookie from the browser manually, I were able to see the new file.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一个缓存问题,而不是cookie。当您清除 cookie 时,您可能也清除了浏览器缓存,因此出现了新图像。
您可能需要检查服务器配置以缓存过期标头。
如果您不知道如何更改它(我无法向您展示如何更改,因为这取决于您的服务器环境),在浏览器上按 Ctrl + F5 执行无缓存刷新可能会有所帮助您会立即看到您的新图像。
It is a caching issue, not cookie. You might have cleared your browser cache as well when you cleared your cookie, so the new image appeared.
You might want to check your server configuration for caching expiration header.
If you don't know how to change it (I can't show you how because it depends on your server environment), pressing Ctrl + F5 on your browser to perform a no-cache refresh might help you see your new image right away.