I want to know how to check if a file exists in a folder, before i upload.
Here's my code
// Folder Name - folder into which I need to upload var FolderName = "Images"; // Root Folder Name var rootfolder = '/Image Library/' + FolderName; // Get the context and Web var clientContext = new SP.ClientContext.get_current(); var oWebsite = clientContext.get_web(); // These are the files which I need to upload into the "Images" folder of the document library var files = document.getElementById(UploadFiles).files;
Now I need to check if the file already exists in the "Images" folder. If it exists , i need to throw a message , "Äre you sure to overwrite?"
I am pretty new to Sharepoint, please suggest if I need to write a CAML query or some other way to achieve this.
Please suggest. Thanks in advance