wood burning stoves 2.0*
The moose likes Servlets and the fly likes FORM Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "FORM Question" Watch "FORM Question" New topic
Author

FORM Question

Ray Gear
Greenhorn

Joined: Mar 20, 2003
Posts: 7
i have this ftp webpage, where i want to pass some info (e.g. server name, username, password) and of cos the file to transfer.... but the problem i am not able to get the info of the server name, etc using getParameter(...) if i use multipart/form-data....
any idea how can i solve it??? very urgent
Lakshmi Dasari
Ranch Hand

Joined: Mar 03, 2003
Posts: 35
Hi,
How are you handling file upload? Are you using any third party package like Orielly's file upload package? You will not be able to read the parameter values from the request object as they are encrypted in case of multipart/form-data for security reasons.


Lakshmi
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

the format of a "multipart/form-data" POST is different than that of a "application/x-www-form-urlencoded" (what you get the rest of the time).

Some web containers (notably older versions of iPlanet) would corrupt a multi-part submission, and your parameters would not be retrieved.
Ray Gear
Greenhorn

Joined: Mar 20, 2003
Posts: 7
i am not using any 3rd party package. it's purely coding in java, using Socket and etc.
so which one should i use 'application/x-www-form-urlencoded' or 'multipart/form-data', if i want to use the input - the server name, username, password and send the file over to the ftp server.
rajesh kumar jhaver
Greenhorn

Joined: Sep 04, 2001
Posts: 9
you can use oreilly package to upload the file to webserver, once it is uploaded, with the use ftp package you can transfer uploaded file onto the ftp server.
[ March 27, 2003: Message edited by: rajesh kumar jhaver ]
Ray Gear
Greenhorn

Joined: Mar 20, 2003
Posts: 7
I think i need to make it very clear... I am not able to use 3rd party package. everything has to be coded in purely java.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61092
    
  66

I think i need to make it very clear... I am not able to use 3rd party package. everything has to be coded in purely java.

Well, that isn't very clear. The 3rd party packages that have been mentioned here are pure Java.
Is what you are really trying to say is that you must personally write all the code for some reason? That's quite different.
If that's the case, then you are going to need to figure out how to parse and deal with multi-part forms. Not very complicated, but not a trivial amount of code.
You can google for the format, or you can dissect the o'reilly classes to figure out how they did it.
hth,
bear
[ March 27, 2003: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: FORM Question