My intention is to delete file from folder But Here in above script is not working properly can any one please suggest me about this

function deleteFile()
{
    var myObject;
    myObject = new ActiveXObject("Scripting.FileSystemObject");
    myObject.DeleteFile("D:\\WEBSITE_FILES\\docs\\OTR\\"+db_unicid+"\\passportImage.jpg");
    return true;
}

 <input type='Button' value='Click to Delete File' onClick='return deleteFile()'> 

Hi and welcome to DaniWeb!

I think there's some confusion here because I'm not seeing where this would be JSP.

This is a JavaScript function that would run client-side, not server-side.

It uses an ActiveX object, which will only work in Internet Explorer, again client-side only.

This file you're deleting would have to be located on the clients' PC. Are you intending to delete a server-side file?

Permissions in Internet Explorer would have to be set such that this site would be trusted to run ActiveX functions, additionally to modify files on the client machine.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.