Click here to Skip to main content
15,911,646 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
when uploading a file in java, always enters null value to the database , i think it because of the enctype="multipart/form-data" in the form tag
Posted
Comments
Sandeep Mewara 18-Apr-11 5:44am    
Care to share the code and add more details for others to look and answer concretely.

1 solution

You must get the Mime Type value before putting it into your database
For example:

import java.net.*;

public class GetMimeType {
public static void main(String[] args) {
 FileNameMap fileNameMap = URLConnection.getFileNameMap();
 String mimeType = fileNameMap.getContentTypeFor("JavaFile.jsp");
 System.out.println("mimeType="+ mimeType);
 }
}


The Mime Type for .JSP files are: mime type "text/html"
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900