Title: Doesn&#039;t work. File open error
Last modified: August 31, 2016

---

# Doesn't work. File open error

 *  Resolved [heromal](https://wordpress.org/support/users/heromal/)
 * (@heromal)
 * [10 years ago](https://wordpress.org/support/topic/doesnt-work-file-open-error/)
 * Code I’m using:
 * [download instance=”1″ name=”Download” datetime=”3.4.2016 17:31″ other=”v.0.9(
   alpha)”]http://mastermentalhealthprogramme.com/wp-content/uploads/2016/05/Master-
   Mental-Health.pdf[/download]
 * Link to page: [http://mastermentalhealthprogramme.com/shop/](http://mastermentalhealthprogramme.com/shop/)
 * Even when I click the button, nothing happens. What’s wrong?
 * [https://wordpress.org/plugins/download-counter-button/](https://wordpress.org/plugins/download-counter-button/)

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [prod3v3loper](https://wordpress.org/support/users/prodeveloper/)
 * (@prodeveloper)
 * [10 years ago](https://wordpress.org/support/topic/doesnt-work-file-open-error/#post-7345621)
 * Hi, thanks for your feedback very useful link.
 * So how did you do it, it is perfectly correct, the fault is due to an outdated
   function called `mime_content_type ()` from the plugin, as it is to watch on 
   your side.
 * I will fix this bug in the next version, no problem.
 * If you do not want to wait, I can offer you, if you can open plugin files (for
   example, ftp, about Hoster surface).
 * Navigate the file in an editor withoutjs.php and exchange in the file these code
   sections in the folder / wp-content / plugins / download-counter-button / functions/
   count / and inside there:
 *     ```
       21 $fullfilepath = $getFilePath . $arr['path']; // Full path to the file
       22 // FILETYPE
       23 $data['Type'] = mime_content_type($fullfilepath);
       ```
   
 * against this code from:
 *     ```
       21 $fullfilepath = '/' . trim($getFilePath, '/') . $arr['path'];
       22 $finfo = finfo_open(FILEINFO_MIME_TYPE);
       23 // FILETYPE
       24 $data['Type'] = finfo_file($finfo, $fullfilepath);
       25 finfo_close($finfo);
       ```
   
 * That should fix the problem. Hope could help you now.
 * It could be that there are still problems with the file size, as your DOCUMENT_ROOT
   can not be determined by any cause, as I said the problem will soon eliminate
   I hope.
 * Best Regards
    Developer
 *  Plugin Author [prod3v3loper](https://wordpress.org/support/users/prodeveloper/)
 * (@prodeveloper)
 * [10 years ago](https://wordpress.org/support/topic/doesnt-work-file-open-error/#post-7345705)
 * Hi,
 * this function is but although outdated should the error still trigger not mime_content_type().
 * You have a problem, a path that is your main path to file can not be determined.
   I might help but, for that I need your help.
 * I can see your document root but he is missing when determining the types and
   size of the file and therefore, these two errors on your page. The path to the
   file must be correct, your problem could have many causes.
 * I still tried the problem to somehow get into the handle but can not promise 
   that it will work for you.
 * Best regards
    Developer
 *  Thread Starter [heromal](https://wordpress.org/support/users/heromal/)
 * (@heromal)
 * [10 years ago](https://wordpress.org/support/topic/doesnt-work-file-open-error/#post-7345711)
 * The problem is the plugin is doing weird things with the link. I’m using this
   code now, after uploading a file called “master.pdf” to the wp-content folder
   via FTP:
 * [download instance=”1″ name=”Download” datetime=”3.4.2016 17:31″ other=”v.0.9(
   alpha)”]/wp-content/master.pdf[/download]
 * The errors:
 * Warning: finfo_file(/wp-content/master.pdf/wp-content/master.pdf): failed to 
   open stream: No such file or directory in /home1/edify/public_html/mastermentalhealthprogramme.
   com/wp-content/plugins/download-counter-button/functions/count/withoutjs.php 
   on line 27
 * Warning: filesize(): stat failed for /wp-content/master.pdf/wp-content/master.
   pdf in /home1/edify/public_html/mastermentalhealthprogramme.com/wp-content/plugins/
   download-counter-button/functions/count/withoutjs.php on line 30
 * You can see it’s looking in “/wp-content/master.pdf/wp-content/master.pdf”
    It’s
   duplicating the link for whatever reason.
 *  Plugin Author [prod3v3loper](https://wordpress.org/support/users/prodeveloper/)
 * (@prodeveloper)
 * [10 years ago](https://wordpress.org/support/topic/doesnt-work-file-open-error/#post-7345726)
 * The problem is that the path is not correct and thus the file is not found, therefore
   the type and size do not occur be determined this error to.
 * This is worng Path:
    /wp-content/master.pdf/wp-content/master.pdf
 * This is your right Path:
    /home1/edify/public_html/mastermentalhealthprogramme.
   com/wp-content/uploads/05/05/2016/master.pdf
 * This warning says that the file was not found:
    Warning: finfo_file (/wp-content/
   master.pdf/wp-content/master.pdf) and as you can see, is the path false.
 * Make the following to make it work:
 *     ```
       21 $fullfilepath = '/home1/edify/public_html/mastermentalhealthprogramme.com/' . trim($getFilePath, '/') . $arr['path'];
       22 $finfo = finfo_open(FILEINFO_MIME_TYPE);
       23 // FILETYPE
       24 $data['Type'] = finfo_file($finfo, $fullfilepath);
       25 finfo_close($finfo);
       ```
   
 * When he again duplicates try this:
 *     ```
       21 $fullfilepath = '/home1/edify/public_html/mastermentalhealthprogramme.com/' . trim($getFilePath) . $arr['path'];
       22 $finfo = finfo_open(FILEINFO_MIME_TYPE);
       23 // FILETYPE
       24 $data['Type'] = finfo_file($finfo, $fullfilepath);
       25 finfo_close($finfo);
       ```
   
 * If it does not work again, please, report and if there is a new error to also
   please write in. This is a small problem.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Doesn't work. File open error’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/download-counter-button_269c61.svg)
 * [MelAbu WP Download Counter Button](https://wordpress.org/plugins/download-counter-button/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/download-counter-button/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/download-counter-button/)
 * [Active Topics](https://wordpress.org/support/plugin/download-counter-button/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/download-counter-button/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/download-counter-button/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [prod3v3loper](https://wordpress.org/support/users/prodeveloper/)
 * Last activity: [10 years ago](https://wordpress.org/support/topic/doesnt-work-file-open-error/#post-7345726)
 * Status: resolved