/* UPLOAD BUTTON */
try {
- if (getParameter("uploadbutton").toLowerCase().trim().equals("false"))
+ if (getParameter("uploadbutton").trim().equalsIgnoreCase("false"))
uploadButton = false;
else
uploadButton = true;
@@ -548,6 +551,15 @@
errorMessage( "maxpixels is null");
} catch (NumberFormatException nummaxpixels){
errorMessage( "maxpixels is not a number");}
+
+ /* Name of file parameter on form */
+ // Defaults to "userfile"
+
+ formFileParameter = getParameter("userfile");
+ if (null == formFileParameter)
+ {
+ formFileParameter = "userfile";
+ }
}
private void removeClick() {
Index: UploadThread.java
===================================================================
--- UploadThread.java (revision 175)
+++ UploadThread.java (working copy)
@@ -390,7 +390,7 @@
// but before the file itself. The length of this, is what is required
// by the content-length header (along with the length of the file).
afterContent = lotsHyphens +"--"+ boundary + lineEnd +
- "Content-Disposition: form-data; name=\"userfile\"; filename=\""+file.getName();
+ "Content-Disposition: form-data; name=\" + main.getFormFileParameter() +\"; filename=\""+file.getName();
if (addPngToFileName)
afterContent += ".png";
afterContent += "\""+lineEnd+
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Being able to specify this will make it easier for me to get this working with django.
(I will be able to easily upload to an existing model this way).
Heres a patch to add this (as "userfile" parameter)
Index: Main.java
--- Main.java (revision 175)
+++ Main.java (working copy)
@@ -92,6 +92,7 @@
private String language, dropImage, dropImageAdded, dropImageUpload, proxy, fileToRemove;
private int maxThreads;
private String [] fileExtensions;
+ private String formFileParameter;
// URI list flavor (Hack for linux/KDE)
private DataFlavor uriListFlavor;
@@ -301,6 +302,11 @@
protected void errorMessage(String message){
out.println("*** "+message+" ***");
}
+
+ public String getFormFileParameter() {
+ return formFileParameter;
+ }
+
// Helper method for getting the parameters from the webpage.
private void getParameters(){
@@ -443,10 +449,7 @@
/* HELP BUTTON */
try {
- if (getParameter("helpbutton").toLowerCase().trim().equals("true"))
- helpButton = true;
- else
- helpButton = false;
+ helpButton = "true".equalsIgnoreCase(getParameter("helpbutton").trim());
} catch(NullPointerException nullwarnmessage){
errorMessage( "helpbutton is null");
helpButton = false;
@@ -454,7 +457,7 @@
/* ADD BUTTON */
try {
- if (getParameter("addbutton").toLowerCase().trim().equals("false"))
+ if (getParameter("addbutton").trim().equalsIgnoreCase("false"))
addButton = false;
else
addButton = true;
@@ -465,7 +468,7 @@
/* REMOVE BUTTON */
try {
- if (getParameter("removebutton").toLowerCase().trim().equals("false"))
+ if (getParameter("removebutton").trim().equalsIgnoreCase("false"))
removeButton = false;
else
removeButton = true;
@@ -476,7 +479,7 @@
/* UPLOAD BUTTON */
try {
- if (getParameter("uploadbutton").toLowerCase().trim().equals("false"))
+ if (getParameter("uploadbutton").trim().equalsIgnoreCase("false"))
uploadButton = false;
else
uploadButton = true;
@@ -548,6 +551,15 @@
errorMessage( "maxpixels is null");
} catch (NumberFormatException nummaxpixels){
errorMessage( "maxpixels is not a number");}
+
+ /* Name of file parameter on form */
+ // Defaults to "userfile"
+
+ formFileParameter = getParameter("userfile");
+ if (null == formFileParameter)
+ {
+ formFileParameter = "userfile";
+ }
}
private void removeClick() {
Index: UploadThread.java
===================================================================
--- UploadThread.java (revision 175)
+++ UploadThread.java (working copy)
@@ -390,7 +390,7 @@
// but before the file itself. The length of this, is what is required
// by the content-length header (along with the length of the file).
afterContent = lotsHyphens +"--"+ boundary + lineEnd +
- "Content-Disposition: form-data; name=\"userfile\"; filename=\""+file.getName();
+ "Content-Disposition: form-data; name=\" + main.getFormFileParameter() +\"; filename=\""+file.getName();
if (addPngToFileName)
afterContent += ".png";
afterContent += "\""+lineEnd+
Can you please email this patch to me.
Thanks, Simon.