How to correct: double file-extension when i download something (media view)

2010-02-03 Thread sebb86
Hello, i almost solved my problem, but there is still a little fault. In one of my views i readout a database cell, with a text inside, e.g. 13.pdf (13.pdf = document_name). The little fault is, when i click on the text in the column (e.g. 13.pdf) a download-windows opens and the file i download

Re: How to correct: double file-extension when i download something (media view)

2010-02-03 Thread John Andersen
The basename function returns the filename with the suffix! Try to change your code to: [code] $basename = basename($file); $file_extension = substr(strrchr($basename,.),1); $basename = basename($file, '.'.$file_extension); ... $this-set('extension', strtolower($file_extension));

Re: How to correct: double file-extension when i download something (media view)

2010-02-03 Thread sebb86
John Hello, thanks for your answer! :) I've added your code. Well, I found out, that my old code (same result with your code) also works, but only with 3 of my 4 test-data-rows. It works for '13.pdf', '288.pdf' and '3.pdf'. It fails for '19.pdf' (result on click = 19.pdf.pdf) and i absolutely

Re: How to correct: double file-extension when i download something (media view)

2010-02-03 Thread sebb86
John Hello, thanks for your answer! :) I've added your code. Well, I found out, that my old code (same result with your code) also works, but only with 3 of my 4 test-data-rows. It works for '13.pdf', '288.pdf' and '3.pdf'. It fails for '19.pdf' (result on click = 19.pdf.pdf) and i absolutely

Re: How to correct: double file-extension when i download something (media view)

2010-02-03 Thread sebb86
John Hello, thanks for your answer! :) I've added your code. Well, I found out, that my old code (same result with your code) also works, but only with 3 of my 4 test-data-rows. It works for '13.pdf', '288.pdf' and '3.pdf'. It fails for '19.pdf' (result on click = 19.pdf.pdf) and i absolutely

Re: How to correct: double file-extension when i download something (media view)

2010-02-03 Thread John Andersen
I suggest you turn on debug and add some debug statements in between your code, so you can see what the content of each variable is at specific places. Debug is turned on in your core.php file in the config directory. Use debug statements: debug($basename); debug($file_extension); and maybe some