×

Loading...
Ad by
  • 推荐 OXIO 加拿大高速网络,最低月费仅$40. 使用推荐码 RCR37MB 可获得一个月的免费服务
Ad by
  • 推荐 OXIO 加拿大高速网络,最低月费仅$40. 使用推荐码 RCR37MB 可获得一个月的免费服务

My web programming is limited using Java Servlets and/or JSP. So....

I take servlet and JSP as examples.

OK, we have a form. This form have three fields: 1) type=text, name=username, value="John"; 2) type=text, name="password', value="1234"; 3) type=file, name="abc.txt", value=".......".

The request will be of the form Http:// .........?username=john&password=1234&abc.txt="...............................".
You can submit the form to any legal URI. If that URI is able to handle
this request and process the parameters are another issue.

If you use Servlet, your form should be submit to a servlet.. This servlet
can use request.getParameter("abc.txt") to get the context of file. For how to process this file, you need to pay some attention to MIME types.
Report

Replies, comments and Discussions:

  • 工作学习 / IT技术讨论 / Hi,guys,Have you submit your resume as attachment in the website?Do you know how it works?Can java do such work?
    • HTML tag is enough for handling this task. No Java here.
      I cannon remember the exact tag syntax. It seems to read
      as follows:

      &\lt input type =file . &\gt

      This is a field in a form. It is essentally the web browser that provides
      functionality to attach the file to your HTTP request.
      Please check the HTML reference.
      • so, where has the file gone after that?
        • Hi, DeepYellow. Here is the sample code
          File Input Element
          <FORM ENCTYPE="multipart/form-data"
          ACTION="urlToInvoke" METHOD="POST">
          <P>First name: <INPUT TYPE="text">
          <P>Last name: <INPUT TYPE="text">
          <P>Brief description of the problem:
          <P><INPUT TYPE="text" SIZE="45">
          <P>Please attach a file with your event log.
          <P>File name:<INPUT TYPE="file">
          <P><INPUT TYPE="submit" VALUE="Submit Report">

          </FORM>


          As you submit the form, the file content, no matter how long it is, will go to the server as a request parameter.
          • Dear Jabber,You're so kind to answer my question and provide me sample code.Thanks you.But I still wonder what will be done by the web developer after the file uploaded to the server.Can you tell me?
            • My web programming is limited using Java Servlets and/or JSP. So....
              I take servlet and JSP as examples.

              OK, we have a form. This form have three fields: 1) type=text, name=username, value="John"; 2) type=text, name="password', value="1234"; 3) type=file, name="abc.txt", value=".......".

              The request will be of the form Http:// .........?username=john&password=1234&abc.txt="...............................".
              You can submit the form to any legal URI. If that URI is able to handle
              this request and process the parameters are another issue.

              If you use Servlet, your form should be submit to a servlet.. This servlet
              can use request.getParameter("abc.txt") to get the context of file. For how to process this file, you need to pay some attention to MIME types.
            • If you are with Microsoft camp, check " Posting acceptor" from MSDN