Delete file fail - DeleteFileUpload

Hi, I’ve just to try delete file from virtual file but it was fail, please how to solve it. Thanks

here is my config
Screenshot 2024-07-15 at 12.45.39

then here is my request
Screenshot 2024-07-15 at 12.04.07

and here is the response
Screenshot 2024-07-15 at 12.04.12

I also convert the dto request to url and the result is
/uploads/dokumen?name=sp-1-15112742.pdf

then using that url i’ve try using get method to hit the api manually like this
Screenshot 2024-07-15 at 12.50.38

here is the actual file list under the folder
Screenshot 2024-07-15 at 12.51.49

Hi @nts,

You will want to populate the Name with the matching UploadLocation, which in your case will be the tmp location. And the Path you will want to specify the path of the file.

Your resolvePath looks like should be able to use the default implementation as it should use the prefix with uploads and then the location name by default.

Try removing the resolvePath, and then your API calls should specify “tmp” as Name, and path should be the original path/file name of the file. The /uploads prefix is handled by the plugin.

Sory just wrong screenshot… here is the right ss of config
Screenshot 2024-07-15 at 13.31.21

The Name needs to be upload location, e.g. dokumen and the Path should be the path to the uploaded file.

so like this you mean?

client.Api(new DeleteFileUpload
{
    Path = "sp-1-15112742.pdf",
    Name = "dokumen",
});

or like this?

client.Api(new DeleteFileUpload
{
    Path = "/uploads/dokumen/sp-1-15112742.pdf",
    Name = "dokumen",
});

but both still fail

What error message does it fail with now? If you’re using the right Upload Location name you shouldn’t get that error message.

Also what is the configuration for your appFs?

and which path is the file being uploaded to?

thank you guys,

solved by this code

var client = new JsonApiClient(baseUrl);
client.Delete<DeleteFileUpload>("/uploads/dokumen/sp-1-34886018.pdf");

without request dtos DeleteFileUpload parameter

2 Likes