The attachment must be in the file area of the current application. During design time this is always **[YourDesignerPath]/files/applications**.
You can always reach these files via API
ivy.wf.getApplication().getFileArea();ivy.wf.getApplication().getFileArea();
Its also documented here: http://developer.axonivy.com/doc/latest/DesignerGuideHtml/ivy.processmodeling.html#d5e5929