Assuming this code is running in a web browser, as per your previous question:
Files on the client
Javascript running in a browser cannot delete files on the client. If it could, this would be a major security vulnerability.
Files on the server
The answer is the same as
Ryan's reply to your previous question[
^]: use
jQuery's .ajax
method[
^], or something similar, to call code running on the server to instruct it to delete the file.
Don't allow the service to accept the path of the file to delete, as this would potentially allow hackers to delete important files from your application. Instead, have the path of the file hard-coded in the service, or stored in a server-side configuration file.
Make sure your application pool is running as a user which has sufficient permissions to delete the file.
Take any necessary precautions to prevent unauthorised users from calling the service.