I wanted to store contacts profile pictures in the public folder and use the public check box to make them viewable on a wordpress website but the images always ask for a login to view.
Here is a screen shot of the uploaded file from the soap api.
/servlet.ImageServer?id=01511000000cmPQAAY&oid=00D1
the api code is as such
FileInfo fileInfo = new FileInfo(memberImageFiles.FullImageFilePath);
byte[] data = File.ReadAllBytes(memberImageFiles.FullImageFilePath);
Document document = new Document{
Name = fileInfo.Name,
IsPublic = true,
FolderId = folderId,
Description = " upload of file " + memberImageFiles.ImageName,
Body = data,
Type = fileInfo.Extension,
IsPublicSpecified = true
};
var curentUser = sfdcBinding.getUserInfo();
SaveResult[] result = sfdcBinding.create( new sObject[] { document });
Contact user = (Contact) getUserIdResult.records[0];
user.Main_Profile_Picture__c = "<img alt=\"" + fileInfo.Name + "\" src=\"https://c.cs18.content.force.com/servlet/servlet.ImageServer?id=" + result[0].id + "&oid=" + curentUser.organizationId + "\"></img>";
here is the image tag that it produces
It it the last line. I ported this over from php and it worked in another sandbox but for some reason it doesn't work in this sandbox. Any help would be greatly appreciated.
Thanks
Pk
Best Answer
Can you try with following steps