dcsimg
Content-Disposition and renaming ring tones
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Stuart_Weitzman
Posted On:   Tuesday, August 10, 2004 10:45 AM

How do you rename a ring tone when dynamically downloading it to a phone? I'm currently utlizing the following code to return the ringtone: response.setHeader("Content-Disposition", "attachment;filename=test.mid"); response.setContentType("audio/midi"); URL url = new URL("ringURl"); URLConnection connection = url.openConnection(); InputStream stream = connection.getInputStream(); OutputStream out = response.getOutputStream(); byte[] b = new byte[4 * 1024]; int len = 0; while ((len = stream.read(b)) != -1) { out.write(b, 0, len); } stream.close(); out.flush(); out.close();    More>>

How do you rename a ring tone when dynamically downloading it to a phone?

I'm currently utlizing the following code to return the ringtone:

			
response.setHeader("Content-Disposition", "attachment;filename=test.mid");
response.setContentType("audio/midi");
URL url = new URL("ringURl");
URLConnection connection = url.openConnection();
InputStream stream = connection.getInputStream();
OutputStream out = response.getOutputStream();
byte[] b = new byte[4 * 1024];
int len = 0;
while ((len = stream.read(b)) != -1) {
out.write(b, 0, len);
}
stream.close();
out.flush();
out.close();


And it works fine, however the Content-Disposition line does nothing, whether or not the "attachment" switch is there or not.

To clarify, this method DOES work in a browser (IE), but not on the phone.

Thanks,
Stu    <<Less
About | Sitemap | Contact