Saving an attachment to a folder on the server with SDK

I did a simple PX which searches for all the items with a certain name and download them into a folder on the server (called ArchivioFile). It worked until last month, I didn’t make any modification, I really can’t understand what happened 🙁
This is my code, am I doing something wrong here?

public void publishFile(IItem item) throws Exception {
        InputStream stream = null;
        try {
            ITable attTable = item.getAttachments();
            ITwoWayIterator it = attTable.getTableIterator();
            while (it.hasNext()) {
                IRow row = (IRow)it.next();
                String filename = row.getCell(“filename”).toString();
                if (!filename.contains(“ftp://”) && !filename.contains(“http://”)){
                    stream = ((IAttachmentFile)row).getFile();
                    File file =  new File(“E:\ArchivioFile\ + filename);
                    FileOutputStream os = new FileOutputStream(file);

                    int d;
                    while ((d = stream.read()) != -1) {
                        os.write(d);
                    }
                    os.flush();
                    os.close();
                }
            }
        } catch (APIException ex) {
            System.out.println(ex);
            ru.appendLogMsg(ex.getLocalizedMessage());
            ru.writeLogFile(this.getClass().getSimpleName());
        }
        return;
    }”

Add Comment
2 Answer(s)

Just as a follow up .  I don’t believe we are ignoring this question yet we feel we do not have the sufficient knowledge base to honestly answer it.  My recommendation is to contact Oracle Support with your need.

Agile Angel Answered on November 19, 2015.
Add Comment

Hi Patrick, thanks anyway! 🙂
I’ll write here in case I find the solution

Agile User Answered on November 23, 2015.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.