Page 1 of 1

Url encode chars like + & is giving me trouble

Posted: Sat Nov 01, 2003 12:50 pm
by ThaRebel
Hi there,

i have this problem about downloading files with a download.php page.

for example

download.php?file=de + factor.jpg


I was hoping there is a sort of command for this to work, else i need to go over all the chars and rename them or something :(. that might be time consuming...

If anybody got an idea plz.

Btw this is the line-code from the form-page:

Code: Select all

<?php
	echo "    <td width=320 bgcolor=#fee0b2 class=normal><a href="download.php?file=" . $row["SourceFileName"] . "" target=_blank>" . $row["Description"] . "</a></td>\n";
?>

And this is the "redirect" line in download.php:

Code: Select all

<?php
      header('Location: ' . $downloadfile);
?>

Posted: Sat Nov 01, 2003 12:52 pm
by Cruzado_Mainfrm
try urlencode($url);
http://us2.php.net/urlencode
good luck

Posted: Sat Nov 01, 2003 12:54 pm
by ThaRebel
I have tried that, without succes.

Posted: Sat Nov 01, 2003 12:58 pm
by ThaRebel
I need to get rid of those "+" or "&" chars... thats simple.. ahum..

Posted: Sat Nov 01, 2003 1:01 pm
by Cruzado_Mainfrm
try:

Code: Select all

<?php
echo "    <td width=320 bgcolor=#fee0b2 class=normal><a href="download.php?file=" . urlencode($row["SourceFileName"]) . "" target=_blank>" . $row["Description"] . "</a></td>\n"; 
?>

Posted: Sat Nov 01, 2003 1:03 pm
by ThaRebel
i did. outcome same :(

Posted: Sat Nov 01, 2003 1:05 pm
by ThaRebel
Got it solved, rawurldecode.

Posted: Sat Nov 01, 2003 1:05 pm
by ThaRebel
Thnx though for your replies m8! :D

Posted: Sat Nov 01, 2003 1:13 pm
by Cruzado_Mainfrm
:roll: damn, but i was close