473,836 Members | 2,294 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2497
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 "URLencodin g",
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.ClearC ontent();
Response.ClearH eaders();
Response.AddHea der("Content-Disposition", "attachment;fil ename=" +
Server.UrlEncod e(doc.FileName) );
Response.AddHea der("Content-Length", doc.FileSize.To String());
Response.Charse t = "UTF-8";
Response.Conten tType = doc.ContentType ;
Response.Binary Write(doc.Image );
Response.Flush( );
Response.End();
"Hans Kesting" <ne***********@ spamgourmet.com > skrev i meddelandet
news:%2******** ********@TK2MSF TNGP11.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 "URLencodin g",
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.ClearC ontent();
Response.ClearH eaders();
Response.AddHea der("Content-Disposition", "attachment;fil ename=" +
Server.UrlEncod e(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.AddHea der("Content-Length", doc.FileSize.To String());
Response.Charse t = "UTF-8";
Response.Conten tType = doc.ContentType ;
Response.Binary Write(doc.Image );
Response.Flush( );
Response.End();
"Hans Kesting" <ne***********@ spamgourmet.com > skrev i meddelandet
news:%2******** ********@TK2MSF TNGP11.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
"URLencodin g", 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******** ******@tk2msftn gp13.phx.gbl...
Henke wrote:
Thanks for your answer.
Here is my code:

Response.Buffer = true;
Response.Clear( );
Response.ClearC ontent();
Response.ClearH eaders();
Response.AddHea der("Content-Disposition", "attachment;fil ename=" +
Server.UrlEncod e(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.AddHea der("Content-Length", doc.FileSize.To String());
Response.Charse t = "UTF-8";
Response.Conten tType = doc.ContentType ;
Response.Binary Write(doc.Image );
Response.Flush( );
Response.End();
"Hans Kesting" <ne***********@ spamgourmet.com > skrev i meddelandet
news:%2******** ********@TK2MSF TNGP11.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
"URLencodin g", 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******** ******@TK2MSFTN GP12.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
14262
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"); header("Content-Disposition: attachment; filename=".$filename); readfile($fullpath); I've also tried using header("Content-Type: application/force-download") instead of header("Content-Type: application/octet-stream"), but get the same results - the downloaded...
5
1997
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 particular user. All the files are links to another cgi script, which will send the files to the user. The problem is the filename - I need to be able to have the save as box
1
1787
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. here is the problem
6
2664
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 even download the measely 1.5MB GIF animator which is in the Tools folder at subscriber downloads. The FTM keeps recycling with retries until it finally times out regardless of the configuration settings. I've been talking with MSDN Customer...
2
1507
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 small issue: when I select save-as to save my file from the web-app to the local disk, the file gets a default filename in the form of <aspx page name>.<original extension>
3
1251
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: http://definitions.symantec.com/defs/20050228-024-x86.exe Notice the filename is: 20050228-024-x86.exe
10
1793
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 stream. Is their a way to determine what the file name is so that I can execute the appropriate functionality of the extensions. The stream is created dynamically so I cannot capture the filename straight from the URL. Thanks STeve
0
2682
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 encoding too, but with no success. Can someone provide details on how to handle the 2-byte char URLs and download the files? Appreciate your suggestions/help in resolving it. Here is my code:
0
1011
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: string filename = "test.zip" WebClient Client = new WebClient(); Client.DownloadFile(url, filename);
0
9812
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9657
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10823
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10532
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10577
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9359
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6975
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
4003
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3103
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.