The specified path is invalid. When using UPLOADINTOSTREAM.

I recently tried using UPLOADINTOSTREAM to load a file from the RoleTailored client into a temporary file on the NAV Server so that I could then process it. This is needed in NAV 2009 because it has three tiers and the tier on which the code executes does not necessarily have access to the files that are accessible on the client. Think about it, you’re c: drive is not the same place as the c: drive on the server.

I tried using the F5 C/AL Symbol Menu to paste the function call with its arguments because, to be frank, I can never remember stuff like this. This pasted the following line of code:

[Ok :=] UPLOADINTOSTREAM(DialogTitle, FromFolder, FromFilter, FromFile, NVInStream)

I then replaced the parameters with the appropriate text strings and variables which gave me this:

UPLOADINTOSTREAM('Profile Metadata', '', '*.XML', FileName, InStream);

FileName and InStream variables of type Text 1024 and InStream respectively.

When I tried to run this command I kept getting this error message:

Microsoft Dynamics NAV
---------------------------

The specified path is invalid.
---------------------------
OK
---------------------------

I couldn’t figure out why I was getting this error, but it turns out using an incorrect value in the FromFilter was causing the problem.

When I changed my line of code to be more like the example in the online help it all worked fine:

UPLOADINTOSTREAM('Profile Metadata', '', 'XML File *.XML| *.XML', FileName, InStream);

I searched for the error message and UPLOADINTOSTREAM in order to find the answer, but found nothing, hence the reason for this blog post.

Oh, and Happy New Year!

Related
Recommended