Username and passwordUsername and passwordI’m evaluate your applet_http_ipreview running on ”IBM Rational Developer for i” (a WebSphere Application Server running on localhost) v.7.5 for my client.
The upload destination is a System i (via local VPN), i.p. address: 192.168.201.4 When test it on my PC, if I sign on with username and password via Windows (map network drive), with no problem to upload the files. The problem is that, I like to embed the user name and password in the Java Script. Here is the code of applet_http_ipreview.js .... //initial setup. 5/13/10 - JChen //document.write('url="http://localhost:8080/upload/process.jsp" '); document.write('url="http://localhost:9082/fileUpload/process.jsp" '); document.write('hidebar="false" '); document.write('paramfile="uploadfile" '); document.write('param1="todo" '); document.write('value1="upload" '); //*************************************************************** document.write('parm2="username" '); document.write('value2="reward1\userabc" '); document.write('parm3="password" '); document.write('value3="XXXXXXXX" '); //*************************************************************** document.write('transferui="jfileupload.transfer.client.preview.PreviewerTransferUI" '); document.write('resources="i18n_bar" '); document.write('transferuiresources="i18n_pane" '); document.write('mode="http" '); document.write('scriptable=true '); document.writeln('pluginspage="http://java.sun.com/products/plugin/ind ... "><NOEMBED>'); // END } else { document.writeln('<APPLET CODE="jfileupload.upload.client.MApplet.class" JAVA_CODEBASE="./" ARCHIVE="lib/jfileupload.jar,lib/httpimpl.jar,lib/chttpclient.jar,lib/clogging.jar,lib/previewui.jar" WIDTH="640" HEIGHT="350" NAME="fileupload">'); } // BEGIN: Update parameters below for INTERNET EXPLORER, FIREFOX, SAFARI, OPERA, MOZILLA, NETSCAPE 6+ support. document.writeln('<PARAM NAME=CODE VALUE="jfileupload.upload.client.MApplet.class">'); document.writeln('<PARAM NAME=CODEBASE VALUE="./">'); document.writeln('<PARAM NAME=ARCHIVE VALUE="lib/jfileupload.jar,lib/httpimpl.jar,lib/chttpclient.jar,lib/clogging.jar,lib/previewui.jar">'); document.writeln('<PARAM NAME=NAME VALUE="fileupload">'); document.writeln('<PARAM NAME="type" VALUE="application/x-java-applet;version=1.4">'); document.writeln('<PARAM NAME="scriptable" VALUE="true">'); //initial setup. 5/13/10 - JChen //document.writeln('<PARAM NAME="url" VALUE="http://localhost:8080/upload/process.jsp">'); document.writeln('<PARAM NAME="url" VALUE="http://localhost:9082/fileUpload/process.jsp">'); document.writeln('<PARAM NAME="hidebar" VALUE="false">'); document.writeln('<PARAM NAME="paramfile" VALUE="uploadfile">'); document.writeln('<PARAM NAME="param1" VALUE="todo">'); document.writeln('<PARAM NAME="value1" VALUE="upload">'); //*************************************************************************************** document.writeln('<PARAM NAME="param2" VALUE="username">'); document.writeln('<PARAM NAME="value2" VALUE="reward1\userabc">'); document.writeln('<PARAM NAME="param3" VALUE="password">'); document.writeln('<PARAM NAME="value3" VALUE="XXXXXXXX">'); //**************************************************************************************** ... When running I have the error 500: Upload failed: server error HTTP/1.1 500 com.ibm.ws.jsp.jspCoreException:java.lang.reflect.InvocationTargetException... Please advice. Thnaks, Jiunn Chen Re: Username and passwordCan you post more of the error you get?
Re: Username and passwordI need your suggestion:
Which manner should I use in connection to my server? 1. Follow your example, just insert user name and password for the connection. As you can see, I just insert the user and password in your souce code. 2. Or shall I need to setup a JDBC coneection in the begining of process.jsp code. Thanks, Re: Username and passwordHi,
I've got more info for you. In process.jsp: <% String directory = "c:/uploads"; %> <% String tmpdirectory = "c:/uploads/tmp"; %> with no error. If I changed to <% //String directory = "c:/uploads"; %> <% //String tmpdirectory = "c:/uploads/tmp"; %> <% String directory = "//192.168.201.4/home/uploads"; %> <% String tmpdirectory = "//192.168.201.4/home/tmp"; %> I have same error 500 as before. If I changed to <% String directory = "MyServer/home/uploads"; %> <% String tmpdirectory = "MyServer/home/tmp"; %> I have no errors with message said "file uploaded", however the files are not found in MyServer. Any idea? Thanks, Re: Username and passwordI think you need to set your url corectly in the applet_http.js file.
Code: Select all
Code: Select all
This should be the actual path to the directory. Such as: Code: Select all
Re: Username and passwordHi,
In applet_http_ipreview.js I already modified: ... //document.write('url="http://localhost:8080/upload/process.jsp" '); document.write('url="http://localhost:9082/nfnFileUpload/process.jsp" '); ... //document.writeln('<PARAM NAME="url" VALUE="http://localhost:8080/upload/process.jsp">'); document.writeln('<PARAM NAME="url" VALUE="http://localhost:9082/nfnFileUpload/process.jsp">'); ... In process.jsp If I modified: <% //String directory = "c:/uploads"; %> <% //String tmpdirectory = "c:/uploads/tmp"; %> <% String directory = "/home/uploads"; %> <% String tmpdirectory = "/home/tmp"; %> How can I specified the destination (My server IP address 192.168.201.4)??? Also shall I use my own JDBC connection to my server before files uploading (instead of putting the user name and password for the connection in http_ipreview.js program)? Please advice. Re: Username and passwordI think you need to create a network share mapped on driver letter.
For instance: - Under Windows: Z:\ maps to \\192.168.201.4\folder1 then: <% String directory = "Z:/uploads"; %> - Under Unix: You have to mount a NFS share. Re: Username and passwordHave you tried this???
//document.write('url="http://localhost:8080/upload/process.jsp" '); document.write('url="http://192.168.201.4:9082/nfnFileUpload/process.jsp" '); ... //document.writeln('<PARAM NAME="url" VALUE="http://localhost:8080/upload/process.jsp">'); document.writeln('<PARAM NAME="url" VALUE="http://192.168.201.4:9082/nfnFileUpload/process.jsp">'); ... Re: Username and passwordHi,
It works fine. No JDBC connection. Just change http IP address for the destination as you said. Great! Thanks, Jiunn Chen |