cancel
Showing results for 
Search instead for 
Did you mean: 

Upload Image to KM Repository

SidBhattacharya
Product and Topic Expert
Product and Topic Expert
0 Kudos

Is it possible to upload an image from a user's machine, store it in a KM folder/rep and get the complete URL for that?

I have an iview which displays a form with the file upload option. Is there a way (perhaps using KM APIs) to add this image to a KM repository and display the URL of the stored image to the user?

Thanks

Sid

Accepted Solutions (1)

Accepted Solutions (1)

detlev_beutner
Active Contributor
0 Kudos

Hi Sid,

for the case you want to develop such a thing, see and/or

If any questions should stay open, just ask.

Hope it helps

Detlev

SidBhattacharya
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Detlev,

Yes it does help. But my requirement is to upload the file to a KM repositoy after the form is submitted. Do I need to make use of KM specific APIS to do this?

Thanks

Sid

detlev_beutner
Active Contributor
0 Kudos

Hi Sid,

yes, but KM API is very intuitive. Read the API, just look around, you'll get very fast an overview.

ResourceContext context = new ResourceContext(iUser);
RID rid = RID.getRID(pathToRepAndFolder);
IResourceFactory factory = ResourceFactory.getInstance();
ICollection folder = (ICollection) factory.getResource(rid, context);
Content content = new Content(new FileInputStream(fuFile.getFile()), fuFile.getContentType(), -1);
IResource newResource = folder.createResource(nameOfFile, null, content);

should give you a good starting point.

Hope it helps

Detlev

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Siddhartha,

If you have content Admin Privileges>Under KM content, select the folder where you want to upload the image, int the menu select folder> New-->Upload. You can Upload many images, and select the properties of the image by clicking on the context menu and selecting the details > Settings->properties--->AccessLinks (WebDEv URL).

If you are interested in looking at creating iview, Try looking at com.sap.portal.pdk.srv.urlgenerator under PDK and try URLGeneratorComponent.

Hope this helps,

Thanks,

Praveen

PS. Dont foget to award points if useful/solved