Title: Multiple problems
Last modified: October 7, 2016

---

# Multiple problems

 *  Resolved [iworldc](https://wordpress.org/support/users/iworldc/)
 * (@iworldc)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/multiple-problems-8/)
 * Hello,
 * I have several issues, that makes this plugin worthless. I use the Jarida theme.
   I cannot switch it or disable other plugins, because the site is a live site.
 * **Problems with this plugin:**
    - When I enter a path to a file outside the web root (to prevent direct access),
      I cannot download it.
    - When I enter a path to a file inside the web root (somewhere in the wordpress
      uploads directory), I CAN download the file, but it’s always ZERO bytes.
    - When I click to upload a file, the file is uploaded indeed, but when I click
      insert, the field where the path to the file should appear remains empty.
 * Regards,
    Maurice

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

 *  Thread Starter [iworldc](https://wordpress.org/support/users/iworldc/)
 * (@iworldc)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/multiple-problems-8/#post-8262684)
 * Okay, I decided to dive into the code myself.
 * In **file sdm-download-request-handler.php** WHY are you using:
 * `ob_end_clean();`
 * When you change that to:
 * `ob_clean();`
    `flush();`
 * You have solved problem 2, the zero byte downloads.
 * I will see if I can find solutions to the other issues (1 and 3)
 *  Thread Starter [iworldc](https://wordpress.org/support/users/iworldc/)
 * (@iworldc)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/multiple-problems-8/#post-8263983)
 * Problem 1 has been solved too. In the same file there is some stupid code:
 * `if ( $dispatch && (stripos($download_link, WP_CONTENT_URL) === 0) )`
 * WHY check if the string ‘[http://domainname/wp_content&#8217](http://domainname/wp_content&#8217);
   exists in the file path? Is this your way to check if a file is local? That’s
   why local files with a PATH, like files out of your web root, are not accepted
   either.
 * For now, I’ve changed that line into:
 * `if ( $dispatch )`
 * I also changed this:
    `$file = path_join(WP_CONTENT_DIR, ltrim(substr($download_link,
   strlen(WP_CONTENT_URL)), '/'));`
 * into this:
 * `$file = $download_link;`
 * Now I can enter a path to a file that’s outside of my web root and download it
   when I click the Download Now button. Now the download files don’t have to reside
   in a publicly accessible folder.
 * So with this, issue 1 has been solved too.
    -  This reply was modified 9 years, 7 months ago by [iworldc](https://wordpress.org/support/users/iworldc/).
    -  This reply was modified 9 years, 7 months ago by [iworldc](https://wordpress.org/support/users/iworldc/).
 *  Plugin Contributor [mbrsolution](https://wordpress.org/support/users/mbrsolution/)
 * (@mbrsolution)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/multiple-problems-8/#post-8265034)
 * Hi Maurice, that looks good. I am happy you solved a few issues. The plugin developers
   will investigate further your solutions and issues.
 * Kind regards
 *  Plugin Author [mra13](https://wordpress.org/support/users/mra13/)
 * (@mra13)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/multiple-problems-8/#post-8265123)
 * I have replied to your following review. I will not be giving anymore reply to
   you and waste my time.
 * [https://wordpress.org/support/topic/worthless-4/](https://wordpress.org/support/topic/worthless-4/)
    -  This reply was modified 9 years, 7 months ago by [mra13](https://wordpress.org/support/users/mra13/).
 *  [Česlav Przywara](https://wordpress.org/support/users/chesio/)
 * (@chesio)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/multiple-problems-8/#post-8293820)
 * Hi Maurice,
 * Since I wrote this stupid code, I feel obliged to chime in.
 * > When I enter a path to a file outside the web root (to prevent direct access),
   > I cannot download it.
 * That’s expected behavior, the plugin supports neither using file path nor dispatching
   files from outside of the WordPress content directory.
 * The reason for not supporting file path is mainly historical – dispatch feature
   is relatively new and before it has been added, you had to use file URL even 
   for local downloads. Since the edit screen UI doesn’t support inclusion of file
   path, neither does the dispatch routine.
 * The reason for limiting dispatch to files in content directory is a matter of
   basic security. Would you like your authors to be able to create download link
   to your _wp-config.php_? Maybe you are the only user of your website, so you 
   don’t care, but you’re not the only user of this plugin.
 * Anyway, your use case is legitimate and it would be relatively easy to add support
   for custom folders to the plugin. It’s a pity you just haven’t asked for it –
   I could have implement it instead of replying to your lament 😉
 * > When I enter a path to a file inside the web root (somewhere in the wordpress
   > uploads directory), I CAN download the file, but it’s always ZERO bytes.
 * Maybe you could give us more details on your webserver setup or why flushing 
   the output buffer before actually outputting file contents is necessary in your
   case? It really interests me, because I don’t see why your change should fix 
   anything, but I cannot replicate your problem without more information.
 * The [ob_end_clean](http://php.net/manual/en/function.ob-end-clean.php) function
   clears the output buffer and stops output buffering. Clearing is done just in
   case to avoid any empty lines etc. output by accident before the dispatch routine
   runs to be prepended to contents of download file. Stopping output buffering 
   is necessary to avoid memory issues, when large files are dispatched.
 * > When I click to upload a file, the file is uploaded indeed, but when I click
   > insert, the field where the path to the file should appear remains empty.
 * This is a bit confusing and the UI would benefit from some improvements here:
   you have to fill in “Link URL” field first, otherwise nothing is inserted. In
   other words, first click on “File URL” button (you want to link to the file URL),
   then on “Insert into Post”.
 * Cheers,
    Česlav
 *  [dylanmierzwinski](https://wordpress.org/support/users/dylanmierzwinski/)
 * (@dylanmierzwinski)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/multiple-problems-8/#post-8368971)
 * To your point on problem three, the UI says that you can upload a file and the
   URL will be populated. I’m having the same issue as this user. If you watch the
   instructional video on the homepage he even shows that you click upload file,
   insert into post, then the url field is populated.
 *  Plugin Author [mra13](https://wordpress.org/support/users/mra13/)
 * (@mra13)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/multiple-problems-8/#post-8369981)
 * Before you hit the “insert” button, can you please make sure that you have the
   file URL in there? Can you see the full static file URL in the “Link URL” file
   of the upload dialogue box? There is a button there that says “File URL” which
   you can click to make sure that field contains the file URL.

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

The topic ‘Multiple problems’ is closed to new replies.

 * ![](https://ps.w.org/simple-download-monitor/assets/icon-128x128.png?rev=973803)
 * [Simple Download Monitor](https://wordpress.org/plugins/simple-download-monitor/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/simple-download-monitor/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/simple-download-monitor/)
 * [Active Topics](https://wordpress.org/support/plugin/simple-download-monitor/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/simple-download-monitor/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/simple-download-monitor/reviews/)

 * 7 replies
 * 5 participants
 * Last reply from: [mra13](https://wordpress.org/support/users/mra13/)
 * Last activity: [9 years, 6 months ago](https://wordpress.org/support/topic/multiple-problems-8/#post-8369981)
 * Status: resolved