TaskType::SAVE_ON_DISK Example?


I’m trying to figure out if it is possible to run a conversion task and have the task put the file in a specific location on the server.

When I try to use the “SAVE_ON_DISK” task type as shown below I get the following error:

$moveTask = new Task();
$moveTask->type = TaskType::SAVE_ON_DISK;
$moveSettings = array(
	0 => buildAtt(TaskSetting::DESTINATION, "C:\\temp\\test.jpg"),
	1 => buildAtt(TaskSetting::ADD_TO_CATALOG, AddToCatalog::DONT_ADD_TO_CATALOG)
$moveTask->settings = $moveSettings;

Any suggestions on how to do a conversion and put the file somewhere (not downloaded) without it being added to the catalog. Or do I need to pursue a custom script for this?




Hi Paul,

Unfortunately, the SAVE_ON_DISK option does not work quite that way.

The DESTINATION TaskSetting will only accept one of two values. “Replace” or “SameFolder”. It does not allow you to specify a new location to save the file. Basically it allows you to replace the source file, or save the new file in the same folder as the source file.

If you do not wish to use Download to get the file to the new location, you could have it renamed and saved to the same folder, then move it to the new location via your script.




One more thing. For the TaskSetting ADD_TO_CATALOG, use “true” or “false” instead of the AddToCatalog enum.



Thanks Matt - I think I tried everything except “false” as a text string. :wink: