i have problem regarding attachments....
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   gurpreet_ahluwalia
Posted On:   Tuesday, May 14, 2002 11:03 PM

hi... the only problem i am facing is how should i handle attachments.. actually i have tried sun example which they have given in javamail 1.2 but that also is not capable of handling attachments in proper way... Multipart multipart = (Multipart)msg.getContent(); Part part = multipart.getBodyPart(partno); String disposition=part.getDisposition(); System.out.println("dis:"+disposition); String sct = part.getContentType(); System.out.println("sct:"+sct); System.out.println("filename="+part.getFileName()); System.out.println("encoding="+part.getDescription());    More>>

hi...

the only problem i am facing is how should i handle attachments..



actually i have tried sun example which they have given in javamail 1.2 but that also is not capable of handling attachments in proper way...




Multipart multipart = (Multipart)msg.getContent();

Part part = multipart.getBodyPart(partno);


String disposition=part.getDisposition();

System.out.println("dis:"+disposition);


String sct = part.getContentType();

System.out.println("sct:"+sct);

System.out.println("filename="+part.getFileName());


System.out.println("encoding="+part.getDescription());




ContentType ct = new ContentType(sct);


response.setContentType(ct.getBaseType());


InputStream is = part.getInputStream();

int i;

while ((i = is.read()) != -1)

out.write(i);

out.flush();

out.close();



this is the example which sun has given....

with what happens is that when the content is image/*

then it does show the image in brwoser but when you try to save the image by right click on the image it does not give the actual file name of the imagelike two.jpg but gives the file name of the programme in which i have done the programming of handling the attachments.... like displayattachment..... and content type of the image is correctly given like if the image is jpg it will show jpg...




now...

when downloading zip file or flash file...
it will show a prompt window to save the file or open the file from current location. when saving this file it will agian show the programme file name rather the actual file name and this time the content of it is also not shown like we have to save it with java.zip...
we have to provide the actual extension to the file...






this is really a very serious problem for me plz help me..

   <<Less
About | Sitemap | Contact