I have a CPT that is justed used for linking to resources on a local drive.
I have this code in single-resource.php:
<?php
global $post;
the_post();
$location = get_post_meta($post->ID, 'sc_stace_resource_location', true);
$count = (int) get_post_meta($post->ID, 'sc_stace_view_count', true);
$count++;
update_post_meta($post->ID, 'sc_stace_view_count', $count);
wp_redirect($location);
die();
?>
Basically the user clicks the resource, the resource counter is incremented and then the user should get taken to the file location. An example file location is:
file://S:/_%20Transfer/Scott/wfw_christmas_041111.pdf
Now if I put this in the address bar of any browser the file is loaded fine. but when I navigate with the above code I get a blank page on webkit browsers and a page cannot be displayed in IE browsers.
Not sure if this is a PHP issue or a WordPress issue.
Anyone know why this isn't working?
UPDATE
It appears that the reason why this isn't working is because of security in the browser. The only solution I can think of is to link directly to the file but if I do this I lose the ability to track the number of downloads. Any solutions?