As I have said, I have the web service running and creating a empty resource. I am having difficulty associating the file in the user private area to the resource.
I know where the drag and drop implementation links the resource to the file;
$resource = new stdClass();
$resource->course = $this->course->id;
$resource->name = $displayname;
$resource->intro = '"';
$resource->description = ''";
$resource->introformat = FORMAT_HTML;
$resource->coursemodule = $this->cm->id;
$resource->type = $this->type;
$resource->files = $draftitemid; // This attribute is pointing to a draft area that contains the file
and then the resource is added
$instanceid = resource_add_instance($resource, null);
I can not get past this point and I would appreciate some help.
What should I assign to $resource->files be so that the resource will contain the file that is in the user private file?
John