doucanrui1735 2014-06-13 05:56
浏览 10

PHP Google App Engine从云存储中永久删除图像

I'm using GAE version 1.9.0 and I want to delete an image from the data storage and upload another image to its location. This is how I'm doing it right now.

unlink("gs://my_storage/images/test.jpg");
move_uploaded_file($_FILES['image']['tmp_name'],'gs://my_storage/images/test.jpg');

And then I want to get the Image serving URL of the latest uploaded image, and I do it like this.

$image_link = CloudStorageTools::getImageServingUrl("gs://my_storage/images/test.jpg");

The issue is, when the name of the deleted image("test.jpg") and the uploaded image("test.jpg") is the same, the old file is served when I call for the newly uploaded file(I think it is cached.)

Is there anyway I can permanently delete this file without caching it?

  • 写回答

1条回答 默认 最新

  • dongpeiwei8589 2014-06-13 16:35
    关注

    You should probably delete the original serving URL before creating another with the same name.

    There's a deleteImageServingUrl() method in CloudStorageTools that you can use to do this.

    评论

报告相同问题?