You could perform this via CSOM/REST API.
Use SP.Web.getFileByServerRelativeUrl Method to request File object and specify SP.File.listItemAllFields property to load list item field values for the list item corresponding to the file:
var ctx = SP.ClientContext.get_current();
var file = ctx.get_web().getFileByServerRelativeUrl(url); //get file
ctx.load(file,'ListItemAllFields');
ctx.executeQueryAsync(
function () {
var listItem = file.get_listItemAllFields(); //get list item for a file
//update list item goes here..
},
function(sender,args){
//error handling goes here..
}
);
A complete example
The following example demonstrates how to retrieve list item by its file url and update it
function getFileWithProperties(url,success,error) {
var ctx = SP.ClientContext.get_current();
var file = ctx.get_web().getFileByServerRelativeUrl(url); //get file
ctx.load(file,'ListItemAllFields');
ctx.executeQueryAsync(
function () {
success(file);
},
error
);
}
function updateListItem(listItem,properties, success,error)
{
var ctx = listItem.get_context();
for(var propName in properties) {
listItem.set_item(propName, properties[propName])
}
listItem.update();
ctx.executeQueryAsync(
function () {
success();
},
error
);
}
getFileWithProperties('/project/Shared Documents/Order.docx',
function(file){
var listItem = file.get_listItemAllFields(); //get list item for a file
var itemProperties = {'Title': 'New Order'};
//update list item
updateListItem(listItem, itemProperties,
function () {
console.log('File is updated succesfully');
},
function(sender,args){
console.log(args.get_message());
}
);
},
function(sender,args){
console.log(args.get_message());
});
Key points:
Two queries are submitted to server, fist one for retrieve file with its properties and second one to update list item.