Upload or download images in SharePoint via InfoPath

In this InfoPath video you'll see how you can upload images to a SharePoint 2013 picture library or attach them to SharePoint 2013 list items, and then afterwards download the images for use in other InfoPath 2013 forms.

In recipes 67 through 71, you'll learn how to upload images to a SharePoint picture library or attach images to SharePoint list items using an InfoPath form, and then afterwards download the images for use in other InfoPath forms.

Get more solutions from InfoPath 2013 Cookbook 2 which is available on Amazon.com
OR
Watch next video: Create InfoPath 2013 forms through SharePoint Designer workflows

InfoPath demo video transcript:

Here I'm in SharePoint 2013, where I'm going to be demonstrating a couple of solutions that make use of images; images which are stored either in a SharePoint picture library, or which have been attached to SharePoint list items.

For the first solution I'm going to be uploading images to this OfficeApplications SharePoint list, and attaching them to a particular list item. If I open an item, for instance Word, you'll see that there is already one image attached to the Word list item. And that is that image there. If I open PowerPoint, you'll see that there are no images attached to the PowerPoint list item. And if I open InfoPath, you'll see that InfoPath has 3 images attached to it.

So I'm going to be using this solution, to upload and attach an image to that PowerPoint SharePoint list item. As soon as the InfoPath form opens, you'll see that this drop-down list box will contain the names of the Office applications, so I'll go ahead and select PowerPoint. And then I'll enter a file name here; powerpoint.png. And then I'll select the PNG file for PowerPoint, and attach it. Click the Upload Image button.

Once the image has been uploaded, what I'll do is, I'll go and check whether it has been attached to that PowerPoint SharePoint list item. So again I'll open the PowerPoint list item. And as you can see here we've got powerpoint.png attached to that SharePoint list item.

Once you have uploaded and attached images to SharePoint list items, you may want to download those images for display in a different form. And for that we'll be using this solution here. So as soon as I click new document to open a new form, you'll see that this drop-down list box will contain the names of the Office applications again, so I can just select one of these, and then the images will be downloaded and retrieved from that SharePoint list.

Once I've done that these images will appear here in this table, and then I can click Select to copy the image over to a different picture control on the form. For items that have more than one image attached to them, you'll get multiple images downloaded and displayed in this table. And then again you can click Select on any one of these images to copy them over to a different picture control on the InfoPath form.

The second thing I want to demonstrate is uploading images to a SharePoint picture library. For that I'll be using this MyPics SharePoint picture library, which as you can see currently contains 4 images and no image for PowerPoint.

I'll be uploading an image for PowerPoint by using this solution here. So I'll click new document, and then I'll just enter the details for the MyPics picture library. I'll upload it to the root folder, so I'll leave that empty. Again enter a name, powerpoint.png, and select the PNG file. And because the image does not yet already exist in the SharePoint picture library, I'll leave this No selected, and click Upload Image. Once the image has been uploaded, I'll go to the MyPics picture library, and check whether the image is present. And as you can see here we've got our PowerPoint image.

Once you've uploaded images to a picture library, you may want to use them in other InfoPath forms. And that is what this solution demonstrates. So again I'll add a new form. When the form opens, you'll see this drop-down list box containing the names of the images that are stored in that MyPics SharePoint picture library. So then I can just go ahead and select an image, and you'll see that the image will be displayed on the InfoPath form.

A second way to select or display images from a picture library would be to navigate sequentially through those images. And that is what this solution does. As soon as the InfoPath form opens, you'll see that it will display the first image. Then you can click Next to navigate to the next image, and continue clicking Next until you reach the very last image. And then again you can click Previous to go back, or click Next to move forward again, and navigate this way back and forth through the images stored in the SharePoint picture library.

Related InfoPath Demo Videos:

Copyright: This article may not be used on web sites (whether personal or otherwise), copied, disseminated, altered, printed, published, broadcasted, or reproduced in any way without an expressed written consent of S.Y.M. Wong-A-Ton. The techniques demonstrated in this article may be used within any Microsoft InfoPath project. This article is provided without any warranties. Copyright for this article is non-transferrable and remains with the author, S.Y.M. Wong-A-Ton.

 
InfoPath 2013 Cookbook 2: 121 Codeless Recipes for SharePoint 2013