Using Qiniu's private Bucket storage, PHP server, set insertOnly to 0, you can overwrite old pictures
Uploaded code:
<code> $key="123.jpg"; $policy=array('insertOnly'=> 0); $token = $this->auth->uploadToken($bucket,$key ,3600, $policy); // 构建 UploadManager 对象 $uploadMgr = new UploadManager(); $result = $uploadMgr -> putFile($token,$key,$path); return $result; </code>
After the upload is successful, this is how I get the image external link:
<code> $baseUrl = $bucketDomain.'/'.$key; $authUrl = $this->auth->privateDownloadUrl($baseUrl); return $authUrl;</code>
Then return to the client tag and update the IMG's src using JS
But I found that the old image is still displayed. How can I solve this problem? Thank you very much!
Using Qiniu's private Bucket storage, PHP server, set insertOnly to 0, you can overwrite old pictures
Uploaded code:
<code> $key="123.jpg"; $policy=array('insertOnly'=> 0); $token = $this->auth->uploadToken($bucket,$key ,3600, $policy); // 构建 UploadManager 对象 $uploadMgr = new UploadManager(); $result = $uploadMgr -> putFile($token,$key,$path); return $result; </code>
After the upload is successful, this is how I get the image external link:
<code> $baseUrl = $bucketDomain.'/'.$key; $authUrl = $this->auth->privateDownloadUrl($baseUrl); return $authUrl;</code>
Then return to the client tag and update the IMG's src using JS
But I found that the old image is still displayed. How can I solve this problem? Thank you very much!
Qiniu Cloud does caching, and the platform management provides a way to refresh the data of the specified URI to obtain the latest data.
I think you should generate a $key
by yourself and add some time to generate random parameters (if you don’t specify the key, Qiniu will randomly hash the file name and store it)