About the action class using the file type to get the contents of the uploaded files, name and content type

Source: Internet
Author: User

The action above provides two properties: Uploadfilename and Uploadcontenttype, which are used to marshal the file names of the uploaded files, and the file types of the uploaded files, respectively. The action class directly encapsulates the file content of the uploaded file directly through the file Type property, but this file property cannot get the file name and type of the uploaded files, so struts 2 encapsulates the upload file name and file type information contained in the domain directly into the Uploadfilename and Uploadcontenttype properties. It can be thought that if the form contains a file field with the Name property of XXX, the corresponding action requires three properties to encapsulate the file field information

1, the type of file of the XXX attribute encapsulates the other file domain corresponding to the content of the files.

2. The Xxxfilename property of type string encapsulates the file name corresponding to the file field.

3. The Xxxcontenttype property of type string encapsulates the file type of the file that corresponds to the file field.

With the 3 properties above, it is easier to implement file properties, so in the Execute method, you can get the file name, file type, and file contents of the uploaded files directly by calling the GetXXX () method.

About the action class using the file type to get the contents of the uploaded files, name and content type

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.