Deleting The File From Client Pc After Upload But Only After Client Permission
I got a requirement from client to delete file from his local pc after upload. It should ask to user if he want to delete the file after successful upload. If user opted yes then f
Solution 1:
Javascript/HTML5 alone can't do this, it's restricted to maintain a certain level of security. You will have to look into activeX plugins, and it will only work if the user runs the web app on IE.
Here is a short example:
<scripttype="text/javascript">// initialize ActiveXObject with Scripting.FileSystemObject: var activeX_FileSystemObject = newActiveXObject("Scripting.FileSystemObject");
if(confirm("Delete file?"))
{
activeX_FileSystemObject.DeleteFile("C:\\myFolder\\myFile.txt", true);
}
// Another way (multiple files in a catalog):if(confirm("Delete file?"))
{
activeX_FileSystemObject.DeleteFile("C:\\myFolder\\*.txt", true);
}
activeX_FileSystemObject = null;
</script>
It's also possible that a Chrome plugin can do the same as the activeX, but never coded one myself - and it's also Chrome spesific.
Post a Comment for "Deleting The File From Client Pc After Upload But Only After Client Permission"