473,408 Members | 1,762 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Filename problems when downloading

I have a web application that is used to transfer files to and from a
database. The files are streamed and stored in the database that is.
From one page I can download the files to the client, by clicking on the
filename.
The confirm download popup (the one built-in in IE) is displayed and I can
select either Save or Open.
One the file name row the name of the file is displayed but all " " (spaces)
are replaced with a "+"-sign. Does anybody know why this happens anf how it
can be solved?

Thanks!
/Henke
Nov 18 '05 #1
6 2466
Henke wrote:
I have a web application that is used to transfer files to and from a
database. The files are streamed and stored in the database that is.
From one page I can download the files to the client, by clicking on
the filename.
The confirm download popup (the one built-in in IE) is displayed and
I can select either Save or Open.
One the file name row the name of the file is displayed but all " "
(spaces) are replaced with a "+"-sign. Does anybody know why this
happens anf how it can be solved?

Thanks!
/Henke


How do you upload the files? Are you using a "Content-Disposition"
http-header? There you can specify a filename to use.

One reason why spaces are translated to plus-signs could be "URLencoding",
but I don't know why that happened in you code (as you didn't give it).

Hans Kesting
Nov 18 '05 #2
Thanks for your answer.
Here is my code:

Response.Buffer = true;
Response.Clear();
Response.ClearContent();
Response.ClearHeaders();
Response.AddHeader("Content-Disposition", "attachment;filename=" +
Server.UrlEncode(doc.FileName));
Response.AddHeader("Content-Length", doc.FileSize.ToString());
Response.Charset = "UTF-8";
Response.ContentType = doc.ContentType;
Response.BinaryWrite(doc.Image);
Response.Flush();
Response.End();
"Hans Kesting" <ne***********@spamgourmet.com> skrev i meddelandet
news:%2****************@TK2MSFTNGP11.phx.gbl...
Henke wrote:
I have a web application that is used to transfer files to and from a
database. The files are streamed and stored in the database that is.
From one page I can download the files to the client, by clicking on
the filename.
The confirm download popup (the one built-in in IE) is displayed and
I can select either Save or Open.
One the file name row the name of the file is displayed but all " "
(spaces) are replaced with a "+"-sign. Does anybody know why this
happens anf how it can be solved?

Thanks!
/Henke


How do you upload the files? Are you using a "Content-Disposition"
http-header? There you can specify a filename to use.

One reason why spaces are translated to plus-signs could be "URLencoding",
but I don't know why that happened in you code (as you didn't give it).

Hans Kesting

Nov 18 '05 #3
Henke wrote:
Thanks for your answer.
Here is my code:

Response.Buffer = true;
Response.Clear();
Response.ClearContent();
Response.ClearHeaders();
Response.AddHeader("Content-Disposition", "attachment;filename=" +
Server.UrlEncode(doc.FileName));
Ah, here is the reason. You don't need to "UrlEncode" this filename. This is
what causes the spaces to be replaced with "+".

Hans Kesting
Response.AddHeader("Content-Length", doc.FileSize.ToString());
Response.Charset = "UTF-8";
Response.ContentType = doc.ContentType;
Response.BinaryWrite(doc.Image);
Response.Flush();
Response.End();
"Hans Kesting" <ne***********@spamgourmet.com> skrev i meddelandet
news:%2****************@TK2MSFTNGP11.phx.gbl...
Henke wrote:
I have a web application that is used to transfer files to and from
a database. The files are streamed and stored in the database that
is. From one page I can download the files to the client, by
clicking on the filename.
The confirm download popup (the one built-in in IE) is displayed and
I can select either Save or Open.
One the file name row the name of the file is displayed but all " "
(spaces) are replaced with a "+"-sign. Does anybody know why this
happens anf how it can be solved?

Thanks!
/Henke


How do you upload the files? Are you using a "Content-Disposition"
http-header? There you can specify a filename to use.

One reason why spaces are translated to plus-signs could be
"URLencoding", but I don't know why that happened in you code (as
you didn't give it). Hans Kesting

Nov 18 '05 #4
Hmm, if I remove the UrlEncode my (å, ä and ö swedish characters) gets
replaced with some strange characters that doesn't exist in our alphabet.
Any other suggestions?

/Henke

"Hans Kesting" <ne***********@spamgourmet.com> skrev i meddelandet
news:e8**************@tk2msftngp13.phx.gbl...
Henke wrote:
Thanks for your answer.
Here is my code:

Response.Buffer = true;
Response.Clear();
Response.ClearContent();
Response.ClearHeaders();
Response.AddHeader("Content-Disposition", "attachment;filename=" +
Server.UrlEncode(doc.FileName));


Ah, here is the reason. You don't need to "UrlEncode" this filename. This
is
what causes the spaces to be replaced with "+".

Hans Kesting
Response.AddHeader("Content-Length", doc.FileSize.ToString());
Response.Charset = "UTF-8";
Response.ContentType = doc.ContentType;
Response.BinaryWrite(doc.Image);
Response.Flush();
Response.End();
"Hans Kesting" <ne***********@spamgourmet.com> skrev i meddelandet
news:%2****************@TK2MSFTNGP11.phx.gbl...
Henke wrote:
I have a web application that is used to transfer files to and from
a database. The files are streamed and stored in the database that
is. From one page I can download the files to the client, by
clicking on the filename.
The confirm download popup (the one built-in in IE) is displayed and
I can select either Save or Open.
One the file name row the name of the file is displayed but all " "
(spaces) are replaced with a "+"-sign. Does anybody know why this
happens anf how it can be solved?

Thanks!
/Henke

How do you upload the files? Are you using a "Content-Disposition"
http-header? There you can specify a filename to use.

One reason why spaces are translated to plus-signs could be
"URLencoding", but I don't know why that happened in you code (as
you didn't give it). Hans Kesting


Nov 18 '05 #5
Henke wrote:
Hmm, if I remove the UrlEncode my (å, ä and ö swedish characters) gets
replaced with some strange characters that doesn't exist in our
alphabet. Any other suggestions?

/Henke


Apparently urlencoding works for those special characters (that
seems to be why you used it).
What if you first urlencode to a temporary string variable and
then simply replace "+" back into space? Would that give the desired
result?

Hans Kesting

Nov 18 '05 #6
Yes that was a good idea, thanks for your help!

/Henke

"Hans Kesting" <ne***********@spamgourmet.com> skrev i meddelandet
news:uH**************@TK2MSFTNGP12.phx.gbl...
Henke wrote:
Hmm, if I remove the UrlEncode my (å, ä and ö swedish characters) gets
replaced with some strange characters that doesn't exist in our
alphabet. Any other suggestions?

/Henke


Apparently urlencoding works for those special characters (that
seems to be why you used it).
What if you first urlencode to a temporary string variable and
then simply replace "+" back into space? Would that give the desired
result?

Hans Kesting

Nov 18 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: deko | last post by:
I need to allow users to download files from a directory that is not publicly accessible. To do this, I use a download script: header("Content-Type: application/octet-stream");...
5
by: Spauldo da Hippie | last post by:
Hello, I'm currently writing a cgi program in perl (target platform will be win32/IIS) that will act as a fileserver. One of the scripts will display a page with the files available to that...
1
by: rudderstick | last post by:
Hi there all, I have an interesting problem.... I work for a company that develops software for the building industry and would like to distribute one of our software products via the web. ...
6
by: clintonG | last post by:
After the last six days trying to download VS2005 Professional it seems there may be a problem with my instance of the File Transfer Manager (FTM) or somewhere in the network in between. I can't...
2
by: Picho | last post by:
Hi all, I am storing binary files on MS-SQL server. my file record includes the original filename. I have created a web application for downloading those saved files and it works ok besided one...
3
by: Crouchie1998 | last post by:
On the following page is for Symantec Antivirus updates: http://www.sarc.com/avcenter/download/pages/US-SAVCE.html Todays virus definition filename & path is: ...
10
by: Steve | last post by:
I am trying to create a downloader which will bypass the saveas box in the WebBrowser control. I have the file downloading, but I don't know what the filename is that is being passed through the...
0
by: jinnareddy | last post by:
Hi, I'm unable to download a file that is having a 2-byte char in its name (e.g.テ) using force download option. Though, am able to download file names involving ASCII chars. I have tried URL...
0
by: fandijunior | last post by:
Hi I have a URL where i will download a file.example: http://www.yyy?user=myuser&password=1234. when i go to this URL i will get a ZIP file as a return. I am downloading the file like this: ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.