When I try to delete an image that I upload to Cloud Storage, I get the following error and I cannot delete it.
Aws\S3\Exception\S3Exception
Error executing "ListObjects" on "myproject.appspot.com" AWS HTTP error: Client error: `GET myproject.appspot.com` resulted in a `400 Bad Request` response: <?xml version='1.0' encoding='UTF-8'?><Error><Code>InvalidArgument</Code><Message>Invalid argument.</Message><Details>In (truncated...) InvalidArgument (client): Invalid argument. -<?xml version='1.0' encoding='UTF-8'?>Error><Code>InvalidArgument</Code>Message>Invalid argument.</Message>Details>Detail&query] [Invalid arcing]
I am currently using Ravel's FileSystem to communicate with Cloud Storage.
The image has been uploaded with the following code.
$fileName='article/'.uniqid(mt_land());
$disk=Storage::disk('gcp');
$disk->put($fileName,file_get_contents($image)));
And the deletion is as follows:
Storage::disk('gcp')->delete([$filePath->image]);
$filePath->image contains a full path such as https://storage.googleapis.com/myproject.appspot.com/article/123456abcd
.
Why can't I delete it even though I can upload it?
Do I have to set up any settings to delete the data in Cloud Storage?
Please let me know if anyone knows.Thank you for your cooperation.
The prefix you specified includes "https://..."
It should just include the object name prefix, not the full URL.
Also, is myproject.appspot.com the name of your bucket?I'm wondering if you want that to indicate the project name.
Also, there is no encoding-type parameter for this request.
The documentation is at https://cloud.google.com/storage/docs/xml-api/get-bucket-list
© 2024 OneMinuteCode. All rights reserved.