parameters ignorned

Upload core product.
Post Reply
cystech
Posts: 2
Joined: Fri Mar 27, 2009 1:13 am

parameters ignorned

Post by cystech »

I have the follow applet_ftp.js file. Explicits replaced with "xxx". Parameters 3-5 are ignored in both Netscape and IE. I can't blacklist, limit file size or number of file uploads.

Help? I've read through all the FAQs and this board. Thanx in advance!

<!--
var _info = navigator.userAgent;
var _ns = false;
var _ns6 = false;
var _ie = (_info.indexOf("MSIE") > 0 && _info.indexOf("Win") > 0 && _info.indexOf("Windows 3.1") < 0);
if (_info.indexOf("Opera") > 0) _ie = false;
var _ns = (navigator.appName.indexOf("Netscape") >= 0 && ((_info.indexOf("Win") > 0 && _info.indexOf("Win16") < 0) || (_info.indexOf("Sun") > 0) || (_info.indexOf("Linux") > 0) || (_info.indexOf("AIX") > 0) || (_info.indexOf("OS/2") > 0) || (_info.indexOf("IRIX") > 0)));
var _ns6 = ((_ns == true) && (_info.indexOf("Mozilla/5") >= 0));
if (_ie == true) {
document.writeln('<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH="250" HEIGHT="250" NAME="fileupload" codebase="http://java.sun.com/update/1.4.2/jinsta ... on=1,4,0,0">');
}
else if (_ns == true && _ns6 == false) {
// BEGIN: Update parameters below for NETSCAPE 3.x and 4.x support.
document.write('<EMBED ');
document.write('type="application/x-java-applet;version=1.4" ');
document.write('CODE="jfileupload.upload.client.MApplet.class" ');
document.write('JAVA_CODEBASE="./" ');
document.write('ARCHIVE="lib/jfileupload.jar,lib/ftpimpl.jar,lib/cnet.jar,lib/clogging.jar" ');
document.write('NAME="clientupload" ');
document.write('WIDTH="250" ');
document.write('HEIGHT="250" ');
document.write('url="ftp://xxx" ');
document.write('param1="username" ');
document.write('value1="xxx" ');
document.write('param2="password" ');
document.write('value2="xxx" ');
document.write('param3="maxsize" ');
document.write('value3="524288000" ');
document.write('param4="maxfiles" ');
document.write('value4="2" ');
document.write('param5="blacklist" ');
document.write('value5="*.exe" ');
document.write('mode="ftp" ');



document.write('scriptable=true ');
document.writeln('pluginspage="http://java.sun.com/products/plugin/ind ... "><NOEMBED>');
// END
}
else {
document.write('<APPLET CODE="jfileupload.upload.client.MApplet.class" JAVA_CODEBASE="./" ARCHIVE="lib/jfileupload.jar,lib/ftpimpl.jar,lib/cnet.jar,lib/clogging.jar" WIDTH="250" HEIGHT="250" 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/ftpimpl.jar,lib/cnet.jar,lib/clogging.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">');
document.writeln('<PARAM NAME="url" VALUE="ftp://xxx.org">');
document.writeln('<PARAM NAME="param1" VALUE="username">');
document.writeln('<PARAM NAME="value1" VALUE="xxx">');
document.writeln('<PARAM NAME="param2" VALUE="password">');
document.writeln('<PARAM NAME="value2" VALUE="xxx">');
document.writeln('<PARAM NAME="param3" VALUE="maxsize">');
document.writeln('<PARAM NAME="value3" VALUE="524288000">');
document.writeln('<PARAM NAME="param4" VALUE="maxfiles">');
document.writeln('<PARAM NAME="value4" VALUE="2">');
document.writeln('<PARAM NAME="param5" VALUE="blacklist">');
document.writeln('<PARAM NAME="value5" VALUE="*.exe">');
document.writeln('<PARAM NAME="mode" VALUE="ftp">');



// END
if (_ie == true) {
document.write('</OBJECT>');
}
else if (_ns == true && _ns6 == false) {
document.write('</NOEMBED></EMBED>');
}
else {
document.write('</APPLET>');
}
//-->

User avatar
support
Posts: 1503
Joined: Sun Jan 27, 2008 6:19 pm

Re: parameters ignorned

Post by support »

blacklist, maxfiles ans maxsize are regular parameters not extra parameters. It must be:
<PARAM NAME="maxsize" VALUE="524288000">
<PARAM NAME="blacklist" VALUE="*.exe">
<PARAM NAME="maxfiles" VALUE="2">

cystech
Posts: 2
Joined: Fri Mar 27, 2009 1:13 am

Re: parameters ignorned

Post by cystech »

Thank you. I am an extreme newbie at this. I've layed eyes on js for the first time about 8 hours ago. I had tried it the way you suggested but the parameters were still ignored. I'm able to upload more then 2 files including .exe files. Surely there's something very simple and stupid I'm not seeing here. Possibly the order of the parameters matters? Thanks again for your help.
Bob G.

Alternate code:

<!--
var _info = navigator.userAgent;
var _ns = false;
var _ns6 = false;
var _ie = (_info.indexOf("MSIE") > 0 && _info.indexOf("Win") > 0 && _info.indexOf("Windows 3.1") < 0);
if (_info.indexOf("Opera") > 0) _ie = false;
var _ns = (navigator.appName.indexOf("Netscape") >= 0 && ((_info.indexOf("Win") > 0 && _info.indexOf("Win16") < 0) || (_info.indexOf("Sun") > 0) || (_info.indexOf("Linux") > 0) || (_info.indexOf("AIX") > 0) || (_info.indexOf("OS/2") > 0) || (_info.indexOf("IRIX") > 0)));
var _ns6 = ((_ns == true) && (_info.indexOf("Mozilla/5") >= 0));
if (_ie == true) {
document.writeln('<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH="1145" HEIGHT="250" NAME="fileupload" codebase="http://java.sun.com/update/1.4.2/jinsta ... on=1,4,0,0">');
}
else if (_ns == true && _ns6 == false) {
// BEGIN: Update parameters below for NETSCAPE 3.x and 4.x support.
document.write('<EMBED ');
document.write('type="application/x-java-applet;version=1.4" ');
document.write('CODE="jfileupload.upload.client.MApplet.class" ');
document.write('JAVA_CODEBASE="./" ');
document.write('ARCHIVE="lib/jfileupload.jar,lib/ftpimpl.jar,lib/cnet.jar,lib/clogging.jar" ');
document.write('NAME="fileupload" ');
document.write('WIDTH="250" ');
document.write('HEIGHT="250" ');
document.write('url="ftp://armymomc.org" ');
document.write('param1="username" ');
document.write('value1="xxxxx" ');
document.write('param2="password" ');
document.write('value2="xxxxx" ');
document.write('mode="ftp" ');
document.write('blacklist="*.exe" ');
document.write('maxfiles="2" ');
document.write('maxfilesize="524288000" ');


document.write('scriptable=true ');
document.writeln('pluginspage="http://java.sun.com/products/plugin/ind ... "><NOEMBED>');
// END
}
else {
document.write('<APPLET CODE="jfileupload.upload.client.MApplet.class" JAVA_CODEBASE="./" ARCHIVE="lib/jfileupload.jar,lib/ftpimpl.jar,lib/cnet.jar,lib/clogging.jar" WIDTH="250" HEIGHT="250" 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/ftpimpl.jar,lib/cnet.jar,lib/clogging.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">');
document.writeln('<PARAM NAME="url" VALUE="ftp://armymomc.org">');
document.writeln('<PARAM NAME="param1" VALUE="username">');
document.writeln('<PARAM NAME="value1" VALUE="xxxxx">');
document.writeln('<PARAM NAME="param2" VALUE="password">');
document.writeln('<PARAM NAME="value2" VALUE="xxxxx">');
document.writeln('<PARAM NAME="mode" VALUE="ftp">');
document.writeln('<PARAM NAME="blacklist" VALUE=*.exe">');
document.writeln('<PARAM NAME="maxfiles" VALUE="2">');
document.writeln('<PARAM NAME="maxfilesize" VALUE="524288000">');

User avatar
support
Posts: 1503
Joined: Sun Jan 27, 2008 6:19 pm

Re: parameters ignorned

Post by support »

Here is enclosed the working JavaScript for what you want to do. I've tested it and it works fine here.
FTPUploadSample.zip
(1.8 KiB) Downloaded 1023 times
Does it work for you ?

Post Reply