Login

mvnForum

mvnForum Homepage Welcome Guest
  Search  
  Index  | Recent Threads  | Unanswered Threads  | List Polls  | Public Albums  | Who's Online  | Help


Quick Go »


No member browsing this thread
Thread Status: Active
Total posts in this thread: 10
Post new Thread
Author
Previous Thread This topic has been viewed 1727 times and has 9 replies Next Thread
Male minhnn
mvnForum Developer
Member's Avatar

Vietnam
Joined: Oct 16, 2002
Post Count: 2956
Status: Offline
Reply to this Post  Reply with Quote 
How to return the correct filename when return the attachment?

Hi all,

mvnForum RC1 supports attachment and the url to download looks like this www.mvnforum.com/mvnforum/getattachment?attach=1

The problem is it always return the name getattachment, and I dont know how to return the real filename of it. I guess this is a HTTP related issue, but dont know how to do blushing

Thanks all
----------------------------------------
Minh Nguyen
mvnForum Developer
Want a free, open source Java Jsp/Servlet forum, get mvnForum at http://www.mvnForum.com

http://www.DienDanLinux.org
[Jul 4, 2003 1:10:01 PM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest    http://www.MyVietnam.net    minhnn_mvn [Link] Report threatening or abusive post: please login first  Go to top 
Male dejan
mvnForum Developer




Joined: Feb 27, 2003
Post Count: 185
Status: Offline
Reply to this Post  Reply with Quote 
Re: How to return the correct filename when return the attachment?

Check out CVS. I have implemented this and commited few minutes ago!

Dejan
[Jul 4, 2003 2:07:45 PM] Show Printable Version of Post    View Member Profile    Send Private Message    dejan_krsmanovic    76119246 [Link] Report threatening or abusive post: please login first  Go to top 
Male minhnn
mvnForum Developer
Member's Avatar

Vietnam
Joined: Oct 16, 2002
Post Count: 2956
Status: Offline
Reply to this Post  Reply with Quote 
Re: How to return the correct filename when return the attachment?

Thanks, it works well love struck
----------------------------------------
Minh Nguyen
mvnForum Developer
Want a free, open source Java Jsp/Servlet forum, get mvnForum at http://www.mvnForum.com

http://www.DienDanLinux.org
[Jul 11, 2003 9:05:45 PM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest    http://www.MyVietnam.net    minhnn_mvn [Link] Report threatening or abusive post: please login first  Go to top 
Male skoehler
Newbie
Member's Avatar


Joined: Jun 27, 2003
Post Count: 32
Status: Offline
Reply to this Post  Reply with Quote 
Re: How to return the correct filename when return the attachment?

Did you use the Content-Disposition header?
It should look like this as far as i remeber:
Content-Disposition: attachment; filename=thisorthat.zip

I already had some troubles with that. Some browsers are somewhat stupid, and still would use the filename from the URL "getattachment".
Only way to fix this is using some weired URL like
/mvnforum/getattachment/123/thisorthat.zip
and 123 is the ID of the attachement.
----------------------------------------
[Edit 1 times, last edit by skoehler at Jul 12, 2003 6:06:19 PM]
[Jul 12, 2003 6:06:06 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Male minhnn
mvnForum Developer
Member's Avatar

Vietnam
Joined: Oct 16, 2002
Post Count: 2956
Status: Offline
Reply to this Post  Reply with Quote 
Re: How to return the correct filename when return the attachment?

Thanks skoehler for your suggestion, but I think we should keep it (that is, a low priority task). We should get more feedback from the community
----------------------------------------
Minh Nguyen
mvnForum Developer
Want a free, open source Java Jsp/Servlet forum, get mvnForum at http://www.mvnForum.com

http://www.DienDanLinux.org
[Jul 14, 2003 8:14:40 PM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest    http://www.MyVietnam.net    minhnn_mvn [Link] Report threatening or abusive post: please login first  Go to top 
Male skoehler
Newbie
Member's Avatar


Joined: Jun 27, 2003
Post Count: 32
Status: Offline
Reply to this Post  Reply with Quote 
Re: How to return the correct filename when return the attachment?

Do i guess that the Content-Disposition header is used, right?
[Jul 15, 2003 2:33:53 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Male dejan
mvnForum Developer




Joined: Feb 27, 2003
Post Count: 185
Status: Offline
Reply to this Post  Reply with Quote 
Re: How to return the correct filename when return the attachment?

Yes. Content-Disposition header is used. Here is the line that fixed this bug:
response.setHeader("Content-Disposition", "attachment; filename=" + attachBean.getAttachFilename());

With this line, correct filename if used when downloading. Works with latest Explorer and Mozilla versions.

Dejan
[Jul 15, 2003 3:26:59 PM] Show Printable Version of Post    View Member Profile    Send Private Message    dejan_krsmanovic    76119246 [Link] Report threatening or abusive post: please login first  Go to top 
Male olaola
Stranger




Joined: Feb 14, 2005
Post Count: 7
Status: Offline
Reply to this Post  Reply with Quote 
Re: How to return the correct filename when return the attachment?

Hi, develpers,

I just installed latest version 1.1, but I have this issue too, all the file name is getattachment. I did find this issue here, any idea of it?
[May 16, 2008 1:30:40 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Male olaola
Stranger




Joined: Feb 14, 2005
Post Count: 7
Status: Offline
Reply to this Post  Reply with Quote 
Re: How to return the correct filename when return the attachment?

oh, i found the problem only happened with chinese file name
[May 16, 2008 1:33:35 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Male minhnn
mvnForum Developer
Member's Avatar

Vietnam
Joined: Oct 16, 2002
Post Count: 2956
Status: Offline
Reply to this Post  Reply with Quote 
Re: How to return the correct filename when return the attachment?

oh, i found the problem only happened with chinese file name

Yes, this bug is noted and will be fix soon smile
----------------------------------------
Minh Nguyen
mvnForum Developer
Want a free, open source Java Jsp/Servlet forum, get mvnForum at http://www.mvnForum.com

http://www.DienDanLinux.org
[May 20, 2008 11:30:48 AM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest    http://www.MyVietnam.net    minhnn_mvn [Link] Report threatening or abusive post: please login first  Go to top 
Show Printable Version of Thread  Post new Thread