Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Server.URLEncode problem 1

Status
Not open for further replies.

EddieVenus

Technical User
Apr 8, 2002
176
US
i am using server.urlencode to change a filename into a URLable filename. I have used it before with no problems. But this time I am using the 'filevariable'.name command in my code it is called f1.name . But for some reason instead of file%20name.avi I get file+name%2Eavi. The . or %2E is no big deal, but the + just do not work in the URL. As you can tell these are video files, and when I try to click on any links with spaces in the name I can see the link on the bottom of the screen, and in the address bar once I click, but I still get a file not found error. Any files without spaces are fine, they open and play just like they should. If anyone has an alternate to server.urlencode, or knows of another way around this small snag, please let me know. Thank you.

EddieVenus
 
UrlEncode does replace spaces with a +, only thing I could suggest is changing all your filenames that have a space to:

file_name.avi www.vzio.com
ASP WEB DEVELOPMENT



 
Interesting, thank you. I was under the impression that there was a way to make these links function. I am using IE6 with winXP pro on IIS 5 with ASP.NET. you would think that all this microsoft crap would work together and let the links work. Are you sure that there is no other way to make the links clickable?
 
snowboardr, you rock. I used your advice in my other forum to fix this one. I just replaced all the + in the server.urlencoded variable with %20's. Works like a charm.
here is the code incase I made no sense just now.
--------------------------------------------------
For Each f1 in objFC
if instr(ucase(f1.Name), ".AVI") then
encdname = server.URLEncode(f1.name)
urlname = Replace(encdname, "+", "%20")
response.write &quot;<tr><td>&quot; & &quot;<a href=&quot; & ojbFV & urlname & &quot;>&quot; & f1.name & &quot;</a>&quot; & &quot;</td><td>&quot; & f1.DateCreated & _
&quot;</td><td>&quot; & f1.Size & &quot;</td><td>&quot;
response.write &quot;</tr>&quot;

end if
---------------------------------------------------
it works like a charm too, it even handles files with funny chars in it like URLencode is supposed to, but without the incompatability. Thank you. Although I do not know where to put the star, here or in the other forum. I guess here is the best choice.
 
I should have thought of the replace function in this case too. Glad I could help. www.vzio.com
ASP WEB DEVELOPMENT



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top