Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
I need to upload image file into the sharepoint 2010 picture library using java script...

requirement is --

1.we have File Upload control

2.And, we have to upload image file from that file upload control

Please see code...But this code is not working.

If any body have better solution that would be nice.

Thanks in advance.
JavaScript
<script lang="Javascript">
function updateListItem() 
{ 
var clientContext = new SP.ClientContext.get_current(); 
var oList = clientContext.get_web().get_lists().getByTitle('Test'); 
var itemCreateInfo = new SP.ListItemCreationInformation(); 
this.oListItem = oList.addItem(itemCreateInfo); 
oListItem.set_item('Title', My Image); 
oListItem.update(); 
clientContext.load(oListItem); 
clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));

}

function onQuerySucceeded() {

alert('Item updated!');

}

function onQueryFailed(sender, args) {

alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());

}</script>
Posted
Updated 26-Sep-12 20:17pm
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900