0

I saved the link refrence in Databse like /PEDB/SupportDoc/5/PRFF or0444.pdf
and used <a href=".$r1[10]." target=_blank>View</a> to show the documents but when I click on view its not showing document because link break where space put in and show blank in explorer like /PEDB/SupportDoc/5/PRFF

8
Contributors
14
Replies
15
Views
6 Years
Discussion Span
Last Post by ayesha789
0

I think this is what you are looking for

$a = "/PEDB/SupportDoc/5/PRFF or0444.pdf";
 $b = urlencode($a);
 echo "<a href='{$b}'>Click</a>";

Edited by jigarvyas: n/a

0

I think this is what you are looking for

$a = "/PEDB/SupportDoc/5/PRFF or0444.pdf";
 $b = urlencode($a);
 echo "<a href='{$b}'>Click</a>";

When i did this it shows
/PEDB/%2FPEDB%2FSupportDoc%2F5%2FPRFFor0444.pdf

Any other idea?

0

I think its not because of space.
Your href link must start with http:// to work in browser.
When you click on link what is url shown in browser?

0

You don't have to have http:// in the href.

The space shouldn't be there. Filenames should not have spaces in them. I'd go at it to change them - change them from space to underscore or similar.

0

I have checked with test name.txt and it works fine in my browser.
and if i give only google.com in my href it won't work.

You don't have to have http:// in the href.

The space shouldn't be there. Filenames should not have spaces in them. I'd go at it to change them - change them from space to underscore or similar.

Edited by vibhaJ: n/a

0

I think its not because of space.
Your href link must start with http:// to work in browser.
When you click on link what is url shown in browser?

My link starts with http:// then local ip then this part /PEDB

as PEDB in root so I do not required to write Http , browser adds automatically

0

You don't have to have http:// in the href.

The space shouldn't be there. Filenames should not have spaces in them. I'd go at it to change them - change them from space to underscore or similar.

any encoding Technique will work ????

0

If you're accessing files in your own domain you do not need 'http://' in the href, you can use absolute or relative references. If you're trying to access files outside your serves, yes you will need some flavour of http://, https:// etc.

You can have spaces in filenames, but be aware that this can cause all sorts of problems. The easiest thing to do is to convert spaces to underscores. Encode if you want, but I think it's best to apply sensible filenames in the first instance. If these files are not yours and you cannot change them (e.e. not your domain), you won't be able to do this though. Having said that, I can't remember the last time I downloaded a file with a silly symbol (space, etc) in it.

0

Why waste all the time while you can solve the problem by removing space? I cannot see what is so peculiar about that space. as Ardav said, remove it and you will be fine!

0

I convert the file names according to my needs and save in DB without spaces.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.