1

i have list called SharesList has image column, so i need to make the end user upload image from his/her local pc... please i need any solutions immediately.

 var siteUrl = '/deanships/6thgraduation'; var uploadedURL, itemTitle; function updateListItem(itemTitle,uploadedURL) { var clientContext = new SP.ClientContext(siteUrl); var oList = clientContext.get_web().get_lists().getByTitle('SharesList'); var itemCreateInfo = new SP.ListItemCreationInformation(); this.oListItem = oList.addItem(itemCreateInfo); oListItem.set_item('Title', itemTitle); oListItem.set_item('test', uploadedURL); 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()); } 

    2 Answers 2

    1

    Try this jQuery Add-in : http://www.phpletter.com/Our-Projects/AjaxFileUpload/

    We recently worked on a similar solution. In our case we already had a REST WCF service so it was easier to add a new API with 1 single 'Stream' parameter and then use the above add-in, which basically creates an iframe with multipart form and then posts the data to a WCF Service. The service receives the data in stream and it needs to be decoded as stated here : http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/7a387bc1-fb7a-4c7b-a17f-19fc167f9621.

    Hope this helps, Jomit

      0

      Have you tried this instead? http://msdn.microsoft.com/en-us/library/websvcimaging.imaging.upload.aspx

      I haven't really seen ECMAScript examples uploading files in SharePoint. Either use a Silverlight Control or one of the Web Services to handle content. Client Object Model comes in many shapes (Managed, ECMA and Silverlight - each with its own constraints and limitations).

      Hope it helps, C:\Marius

      2
      • Thanks for your answer i will check it but i think it's helpful, but can i add item from picture library to list by javascript or JQuery ?CommentedMay 14, 2012 at 20:22
      • If you would manage to wrap it around the call for the Web Service, yes you can. See here for an example blueimp.github.com/jQuery-File-UploadCommentedMay 14, 2012 at 23:50

      Start asking to get answers

      Find the answer to your question by asking.

      Ask question

      Explore related questions

      See similar questions with these tags.