Attaching file to a record using the API

Is there a way to upload one or more files to a record using the API? I can see this behavior using the web front end but can’t see any info in the wiki on how this is done through the API.

Secondly, is there a way to upload files as part of creating the record or can it only be done after the record has been created?

Hi Darren Lewis,

I have a java snippet to take the image value from one object to another object. you can go through this. This code may help you…

package com.platform.mounika.picktest;
import com.platform.API.;
import com.platform.API.mail.
;
import com.platform.beans.;
import java.util.
;

public class pickImg
{
public void invoke(Parameters p) throws Exception
{

String id=p.get("id");
PlatformFileBean file =null;
String queryFrom="NewObjects";
String queryWhat="image";
String queryWhere="";
Result queryResult=Functions.searchRecords(queryFrom,queryWhat,queryWhere);
int SLAQueryCode = queryResult.getCode();
ParametersIterator iterator = queryResult.getIterator();      
while(iterator.hasNext())
{
	Parameters SLAParams = iterator.next();
    String img =SLAParams.get("image");
    Result result = Functions.getDocument(img.split(":")[1]);
    Parameters params = result.getParameters();
	file =params.getPlatformFileBean(img.split(":")[1]);     
}
  p.add("column_id","aaa");
  p.add("image",file);
  Result r=Functions.updateRecord("ImageObjects",id,p);
}

}

Regards,
Mounika