Sidebar

newNetFile erroring on writeFile: Unable to create the directories for file

0 votes
115 views
asked May 19, 2023 by brandon-p-9741 (150 points)
We have a customer that needs to store content on a network share.

I was trying to test this locally by creating a local windows share on my computer and writing to it.  The share exists, but when I try write to it, I get this error:

JavaException: java.io.IOException: Unable to create the directories for file: smb://BPETTY-PC/prodshare/IHed11cfa8842b2023051913493969PAT_AN56841 2990152   DT00172        .pdf

I am not sure why it is trying to create a directory.  I simply want it to create a file.

Any ideas?

 

Example:

   const networkFile = qie.newNetFile('//BPETTY-PC/prodshare' + '/' + name, '<USER>', '<PWD>', false);

   try {

      qie.writeFile(networkFile, value, true);

   } finally {

      networkFile.close();

   }

1 Answer

0 votes
 
Best answer
I tracked your issue to the qie.writeFile() function; it appears to try and create folders if the third argument (shouldCreatePath) is set to true, as yours is.  Setting it to false will allow it to work properly.  I'm researching to see if that is expected behavior or not, but for now, set the third argument to false if your path already exists.
answered May 19, 2023 by jon-t-7005 (7,590 points)
selected Jul 10, 2023 by brandon-p-9741
...