I have files that i upload to the website that might contain spaces such as:
file name 1.wav
It displays normally when uploaded, however when trying to download the file from Chrome and Firefox i get the following results:
Chrome downloaded: file name 1.wav (perfect)
firefox downloaded: file (bad)
name 1.wav was removed from name. Is there any specific functionality in PHP that will fix this problem in firefox?
CODE:
<?= str_replace(array("'",'"'), array("'","""), stripslashes($sFileTitle)) ?>', '<?=$f['fileExtension']?>'
This is what shows up when i inspect the element on anchor tag where file should be downloaded:
<a title="file name 1.wav" fileid="254" class="docLink">file name 1.wav</a>
i use JQuery to redirect to the correct path.
FIX:
Adding urlencode($file) fixed it but arose a new problem. Now file with name
file name 1.wav
turns into when downloading:
file+name+1.wav
is it possible to replace + with space once downloading? urldecode didnt work
Solution:
if someone else having same problem here is how i fixed it:
instead of urlencode/decode i just did this:
'"' . stripslashes($file) . '"'
and it fixed it
1 Answer