Support » Plugins and Hacks » [Plugin: user files] BUG: Files uploaded to wrong folder

[Plugin: user files] BUG: Files uploaded to wrong folder

  • WP 3.1.3
    Private Files 0.40

    I’ve uploaded a file for a given user from Manage Files dashboard column menu (Add Files) option. Manage files correctly displays the uploaded file.

    However, dashboard Your Files shows the following error:

    Warning: opendir(/home/www/website.com/wp-content/uploads/file_uploads/1) [function.opendir]: failed to open dir: No such file or directory in /home/www/website.com/wp-content/plugins/user-files/user_files.php on line 556
    You have no files

    I’ve created a page that displays the user files where the following code has been added to the page:

    Warning: opendir(/home/www/website.com/wp-content/uploads/file_uploads/1) [function.opendir]: failed to open dir: No such file or directory in /home/www/website.com/wp-content/plugins/user-files/user_files.php on line 480
    You have no files

    I have checked out the file structure in the server and the folder that has actually been created is:

    Yes, number 2, so obviously, the above errors are displayed? Any chance to get this fixed?

    By the way, here’s my suggestion to improve this very cool and much useful plugin: Manage files should display login name apart form real name and email. It’d be more convenient when having to access the user profile.



Viewing 8 replies - 1 through 8 (of 8 total)
  • One more thing, folder “2” has 777 permissions… Shouldn’t it be at least 755? For security’s purpose.


    Plugin Author Scriptonite


    Thanks for the feedback. The warning message has been fixed and the fix will be included in the next release. Also added will be categories, click to download icon, icons, and more. I have been really busy and have not had time to finish the updates.

    I haven’t tested the permissions with 755, I can see if it will work properly there is no reason why they can’t be.

    2.0 was scheduled for release at the end of this month but it may be mid-July now before it is ready.

    This is a pretty awesome plugin! Will be looking forward to the new version.

    Resolving those errors will be very handy.

    Found out that you can upload a heap of files via FTP to any specific folder in the file_uploads folder.

    Hello everyone,

    I am using wordpress 3.2.1 and userfiles plugin (2.0.7). The files are getting uploaded from admin and user end fine with full content. User can see their files on the list. But, when a user clicks on “Download” option, the file gets downloaded without any content (File size is displaying 0 byte). The admin also faces this problem. Also, admin or user can not delete the file by clicking on “Delete” option.

    Please help me on this or let me know what i have to do. I was going through the functions.php file for a solution. Not yet succeeded.

    Thanks in advance.

    Plugin Author Scriptonite


    Is the file the correct size on the server or does it corrupt the file when it uploads?

    Are you running PHP 5?

    Also, what other plugins are you running? It seems like there may be a conflict.

    Yes, the file is correct size on the server. Its not a corrupted file.

    And , also i am using PHP5.

    I am using the following plugins:

    1) Featured Articles Lite
    2) Cforms
    3) Flexi pages widget
    6)Wp user registration.

    I also tried on a new wordpress site. This is a fresh install of WP 3.2.1 and installed only one plugin that is User files 2.0.7 . And found the same issue.

    I was going through the files and fixed few issues.

    1) Delete file (for user):

    On functions.php file i edited the manage_files_function function.
    Added $file_path=$upload_dir[‘basedir’].’/file_uploads/’.$current_user->ID .’/’.$_GET[‘deletefile’];

    And called the variable on unlink.

    Thats it and fixed the issue. Though, it should work as you coded it earlier. But i have no idea why it was not working.

    2) Download of files (for normal user) :

    Modified this two lines on functions.php (line 40)

    $dnlLink = curPageName().’?page=manage-files-user&theDLfile=’.$Thefile;
    $DelLink = curPageName().’?page=manage-files-user&deletefile=’.$Thefile;


    On user_files.php modified function getDownloads() .

    Firstly, the if condition was wrong . It will be if(!$file) ..

    Secondly, inside the else of above if loop add this .


    And call that on readfile($full_file_path);

    Also i am not using this header(‘Content-Length: ‘ . filesize($file)); as its returning 0 bytes each time.

    thus the user can download the files.

    I am working on Admin download option. If i succeed i will post the procedure.

    Thanks a lot for this plugin and your help.

    Also, if you found a better solution please post and help me to fix on admin.

    Plugin Author Scriptonite


    I fixed a typo in an update this morning, I will look at the admin area this afternoon and see if I can find the issue. I will add in these changes this evening and release another update. Thanks so much for tracking down these issues.

    Fixed the other issue regarding Admin download option…


    1) On ListAdminFiles function (functions.php page) replaced old download link with the below line inside <td>

    2) On getDownloads function (user_files.php page) added the below lines after get_currentuserinfo();




    // echo “

    $file = $_GET[‘theDLfile’];

    $url=$upload_dir[‘baseurl’].’/file_uploads/’.$current_user->ID .’/’;

    $file = $theDLfile_array[1];

    $url=$upload_dir[‘baseurl’].’/file_uploads/’.$theDLfile_array[0] .’/’;

    This is how i fixed the issues.

    Also there was an issue regarding file names. If the file name is “abcd efgh.doc” , there will be an error for the space. So, i used str_replace on upload option. This will have to use on bothe the files.

    Anyways, thanks to the original developer for this nice plugin. Helped me a lot and saved my time.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Plugin: user files] BUG: Files uploaded to wrong folder’ is closed to new replies.