Accessing Local Files From Web Client

peterbruce

peterbruce

Legendary Poster
JDEList,

We are upgrading to E8.11 and need a way to access local files from the Web Client. Currently in Xe we use a combination of UBEs and TCs to import files from the local fat client (import directory) into OneWorld. Is there a way to browse the local file system and pick up a file to import via UBE/TC in 8.11? We have thought about all sorts of methods of getting the files into the import directory on the Enterprise Server (a Sun Unix box) but they are clunky, time consuming and not easily automated in addition to all sorts of security issues as well as the windows/unix file sharing and text format problems.
 
Peter do you only want to view or do you want to add/modify? Also what group of users is this requirement for?
 
Cherub,

I want the file to be made available to be processed by a UBE/TC that is being run on the server. This will probably mean that it needs to be copied to the import directory in the pathcode on the Enterprise Server.
 
Try to insert some javascript via text blocks.




CopyFile(source, destination, overwriteFlag) Undefined


This method copies a source file to a destination file. If the destination file exists, it is overwritten only when overwriteFlag is true. On some systems, the destination file cannot be overwritten no matter what. Here is a script that copies test.txt from f:\ to f:\dest:
<SCRIPT LANGUAGE="JavaScript">
<!--
var fso = new ActiveXObject("Scripting.FileSystemObject");
var newpath = fso.CopyFile("f:\\test.txt", "f:\\dest\\test.txt");
-->
</SCRIPT>
 
Ok, I just wrote a test and JavaScript does indeed work.

It's really very simple actually. On your form insert a Text Block and create a new sebment. Then place a javascript function followed by a simple button that executes the script.

For some reason I could not 'paste' my script into the block like I should; it would not save if any carriage returns were present. However, if I typed it in, or pasted code with NO carriage returns then it would save. This has got to be a bug in the dev tools.

Note that to get the code above to work you must change the ActiveX security to at least 'prompt' level for your browser. Anyway, this seems like a really simple solution for copying files from one directory to another.

Good Luck!

p.s. Here's the script and button I tested. It simply shows a popup window, but proves the concept:

<SCRIPT language="JavaScript">
function path()
{var fso = new ActiveXObject("Scripting.FileSystemObject");
var newpath = fso.BuildPath("c:\\tmp","kuku.txt");
alert(newpath);
}
</SCRIPT>

<FORM>
<INPUT type="button" value="Click here" onClick="path()">
</FORM>
 
Darren,

Thanks, I really appreciate your reply and effort on my behalf. I will probably have some questions on how to implement your suggestions, but at the moment I have another priority. I will reply to your post again as soon as I get a chance to look at it.
 
Darren,

I inserted a text block and added a segment and tried to paste your code into it. I got the following error when I clicked the apply button:

If this text block is to be translated its length should not exceed 80 characters. The total length of all segments in this blocj is: 281.

Is this the same error you got? Do I have to type it in? Have I done something wrong? Or is this something different all together?
 
Yes, I got it. It's not an error, it's a warning. This looks like a 'standards enforcement' for developers to not exceed 80 chars because of multi-language translation requirements. Just ignore it.

If the code doesn't appear to do anything then change your activeX security for the browser to either 'prompt', or 'allow'.
 
Darren,

[ QUOTE ]
Here is a script that copies test.txt from f:\ to f:\dest:


[/ QUOTE ]

I re-read your posts on this thread. I'm guessing that the script you provided requires that the user has access to f:\ and f:\dest from the client machine. Please correct me if I am wrong.

What we require is an JDE application that will run on the web that will open a local browser to allow the user to pick up a file from the local machine. The application would then save it on the Unix Enterprise Server. Such an application may be able to strip the CR characters out and then kick off a UBE/TC to pick up the file on the Unix Enterprise Server to process it. The user would not have any access to the Unix Enterprise Server apart from that provided via JDE. Will putting java script in a segment in a text block be able to accomplish this?
 
No, you're not wrong. If the user cannot map network drives then what I spelled out above won't work.

You're not entirely lost though. You can still insert javascript that allows a user to press a button, select a file, and upload it to the server.

The server will receive the file and run a CGI script (can be c/c++, java, etc.) that parses it and places it wherever you want. The UBE process can be a simple constant batch job that watches for new entries into the directory of your choice. This part depends on your company's requirements.

It's not actually as complex as it sounds. I haven't built this particular puzzle yet, but I know all the pieces and you can do it in a couple weeks. At least that's what I think given the basic information you've spelled out.
 
Darren,

I think that is exactly what I wanted/needed to read, THANK YOU. I am pretty much in the dark as regards technicals of what you have suggested, but I think this would be the way we need to go. We are very close to the sharp end (go live) of our upgrade, and will not have time to try your suggestion. But after we go live I would be very interested in putting you suggestion into action, and would need a lot of your help. I will either contact you off line or reply to this thread when we are ready.

Once a gain thanks for your help.
 
Peter,

Did you ever get this to work for you? We're embarking on the move to web clients, and have a need to be able to kick off a local application on a web client, passing in one or more parameters. It sounds a bit like what you want to do, but with a different twist. If you had any luck with your efforts, they'd be very interesting to hear. Thanks!
 
Don,

I haven't done this yet - but I still need to - it's just that other things always seem to get in the way with a higher priority. However JDEList Member vkazakid has done something similar - see this thread. I am very interested in how you go with this - please keep the List informed.
 
Hi,
I am trying similar thing from E9.1. (TR 9.1.2) using Text Control Box from my Fat Client.
I have a script which opens a file from local machine.
If i call the script file directly from Internet Explorer, it runs perfectly and opens the file.
But when i execute the same script through Text Block, i am getting error "Object Expected".
when i checked in debugger, the error is occuring in the script where we call the function 'onClick' event of the button. (Error details - Breaking on Jscript runtime error : Object Expected).
I have enabled the security through P00950.

Any idea, why it is failing through Text control box?

Thanks in advance.
 
Back
Top