Hello,
the final download of the plugin is implemented in these three simple lines:
header(“Content-Type: $type”);
header(“Content-Disposition: attachment; filename=\”$filename\””);
readfile($path);
If there is added a text like “<!– ignored –>” to the downloaded file this must be an effect from the command “readfile($path);”
This is a simple php function which of course can have influence of the php settings on your new provider.
Strange for me is, what is the difference if you are logged in with your WP account. This should not differ for the php settings on your system.
Thread Starter
pderks
(@pderks)
Hi Peter,
Thanks for your reply. I already suspected that my new provider was interpreting the php command differently, so I also send them an email with the same question. They responded quickly and told me that is is better to put the plugin parameter $type as last parameter in the command. They told me that the parameters after the $type parameter are also seen as the $type parameter. I searched in the plugin and, since I’m not using the other parameters, I deleted the other parameters (like $check) from the readfile($path) command (so only using parameters $filename and $type. Guess what? It worked!
I’m not a professional php programmer and I still don’t understand exactly what was wrong, but I’m happy I’ve got it working.
Mayby you can have a deeper look at it.
Thanks Peter
Hi,
thank you for the detailed information.
could you send me your the shortcode which did not run to analyse the problem with the parameters? (you can modify the download path, if you don´t want to send it).
Thread Starter
pderks
(@pderks)
Hi Peter,
It’s the basic shortcode: [filedownload file=”uploads/gpx/Dommeldal-2012.gpx”]Download gpx bestand[/filedownload]
You can have a look at the website http://www.tcerp.nl/activiteiten/activiteit/dommeldal-2012/
This is what i’ve done to get it working:
In the function filedownload_shortcode_handle($atts, $content = null)
I’ve changed the return function
from
return "<a href="$plugin_dir/filedownload/download.php/?path=$path&type=$type&check=$check&referer=$referer">$span$content</span></a>";
to
return "<a href="$plugin_dir/filedownload/download.php/?path=$path">$span$content</span></a>";
=> I deleted all the parameters exept $filename (for me no problem since i’m not using the parameters).