Yeah, you have to do the identification in the server, there are various libraries that makes it easy.
- http://sourceforge.net/projects/mime-util MimeUtil.registerMimeDetector("eu.medsea.mimeutil.detector.MagicMimeMimeDetector"); File f = new File ("c:/temp/mime/test.doc"); Collection<?> mimeTypes = MimeUtil.getMimeTypes(f); System.out.println(mimeTypes); - http://sourceforge.net/projects/jmimemagic/ Magic parser = new Magic() ; MagicMatch match = parser.getMagicMatch(new File("gumby.gif")); System.out.println(match.getMimeType()) ; - http://lucene.apache.org/tika/ File f = new File("C:/Temp/mime/test.docx"); FileInputStream is = new FileInputStream(f); ContentHandler contenthandler = new BodyContentHandler(); Metadata metadata = new Metadata(); metadata.set(Metadata.RESOURCE_NAME_KEY, f.getName()); Parser parser = new AutoDetectParser(); parser.parse(is, contenthandler, metadata); System.out.println("Mime: " + metadata.get(Metadata.CONTENT_TYPE)); Source: http://www.rgagnon.com/javadetails/java-0487.html Manolo Carrasco On Tue, Sep 29, 2009 at 8:44 PM, Thomas Broyer <t.bro...@gmail.com> wrote: > > > > On 29 sep, 13:59, "vaibhav.saxena" <vaibhav....@gmail.com> wrote: > > Hi, > > I am using form panel in my GWT client code. I need to detect the > > content type on my server side of the file being upload. Now strange > > thing that is happening is something defined below: > > > > When i upload a image i get the correct content type "image/jpeg" but > > when i upload a video of type mp4 i used to get "application/octet- > > stream" while i should get "video/mp4". > > GWT doesn't (and actually cannot) do anything about it, it's just what > your browser chooses the send. You can test with a plain HTML <form> > and you should get the same result. Not a GWT bug. > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en -~----------~----~----~----~------~----~------~--~---