• I’m afraid this plugin is not working (at least for me) in WP 2.7 because when a file is first uploaded to the default folder the corresponding row in db table wp_postmeta holds just the filename, not path and filname. So
    $attachment_path=get_post_meta($id,"_wp_attached_file",true);
    does not get the right value. That is why
    if (rename($attachment_path,$new_path))
    does not work and returns false.

    Maybe you should check if the filename is stored with or without path in wp_postmeta and construct $attachment_path accordingly.

    http://wordpress.org/extend/plugins/relocate-upload/

Viewing 15 replies - 31 through 45 (of 61 total)
  • I am using version 2.8 and all is fine until I get to the upload screen where I pick which folder to move the file to, I am getting a “Failed” message.

    Hmm… I keep getting the same error as well, even with the dev 0.13 version on WP2.8.

    On the plugin settings page I can’t get rid of the red borders (signifying that the folder is not-writable or something) and thus on the upload screen I keep getting Failed message as well.

    And I know those folders exist, are writable, and the full path is correct.

    What gives?

    Hey Alan, can I pay you or get in touch with you directly somehow to get this plugin working on 2.8 and on my server?

    I’ll gladly do that… just let me know how to go about it.

    Hi guys, I have the same problem with WP 2.8 🙁 I really like this plugin and I need it for my work, so if somebody can help with this issue I’ll be very appreciated

    damn – not bothered to check this one in 2.8. i will have a look over asap – over the weekend if i can. it may well be just a few simple tweaks.

    very nice of you to offer payment! not necessary, but I can point you at the main plugin i maintain

    http://wordpress.org/extend/plugins/widget-logic/

    which has a charity collection in the donate link

    i tried it last night and it worked ok.

    CrazySerb – have you checked that the folders are actually modifiable by WP? check the folder permissions.

    Oh yeah, that was the first thing I checked (they’re all at 777). Trust me, I’ve spent like 2 hours going back and forth with all the possible settings, permissions, pieces of code that I thought would make a difference – nothing.

    Any way you can get a hold of me at crazyserb[at]gmail.com? The reason why I offered to pay you for this is because this is a missing link in this big puzzle of a website I’ve put together for a friend, and without your plugin in place, working properly, there’s gonna be a lot of issues with the alternate method of uploading attachments to different folders. And I’d rather pay someone for their time spent looking into this for me and fixing it (someone who knows what the issue might be) than me going with a Plan B, a workaround.

    i’ve mailed you

    Hi all, have you found a solving of this issue? I’m using RU v 0.13, WP 2.81. On «Relocate Upload – Locations» page I don’t have any red borders around my location fields, but when I’m choosing destination folder on «Media library» page, I have «failed» message 🙁 I tried different locations and different permissions for folders, but it doesn’t work. If you have any thoughts why is this happening, please mail me at bezz.mail[at]gmail.com And thank you Alan for all your help.

    some starting points for troubleshooting

    find an example media item and let me know the “File URL” as listed in the Edit Media page (Click edit on that item in the media library list)

    Then from the relocate upload options tell me what the path in bold after “Paths are relative to the blog root” is and also what the ‘default location’ path is (listed at the top in grey)

    also, it would be good to know what your method for uploading media items is, in case it’s unusual

    Alan thank you for sharing your Relocate Upload plugin. It’s almost working for me.

    I’m using RU 0.13 and WP 2.8:

    1) I can upload files to the Media Library, Select Edit and successfully ‘move’ them to alternate folders, as configured in Settings -> RU.

    2) When I reselect Edit in the Media Library, the File URL reflects the new directory path to the recently moved file. So far so good!

    3) And yes, I can also delete ‘moved’ files thru the Media Library interface.

    However I have not been able to list the ‘moved’ files using the Media Library Filter button. Yes, the alternate folders configured in RU show up in the pop-up next to the ‘Filter’ button in the Media Library. But selecting any value other than ‘All Folders” returns an empty list of files.

    So thanks to RU I can now upload files and move them to alternate folders, but I can never list these files in a specific alternate folder. Only if I specify I want to filter on ‘All Folders’, do I get a listing of files. Of course, by specifying a ‘filter’ of ‘All Folders’, I lose the advantage of having multiple folders to organize the Media Library. I can’t list the contents of these Alternate folders. I can only list the contents of all the folders. And yes it works — I see all the files listed including those that have been moved by RU to alternate folders.

    Do you have any suggestions as to where I should focus my debugging efforts? Or any information that I could share on this forum to help provide insight into why I can’t list the files in the alternate folders?

    thank you!

    ok, well the way that filter works is to narrow down the list to items whose ‘guid’ matches the folder path you select. so the most obvious thing that might go wrong is that the guid is not changing appropriately when the file is originally moved.

    i’m not 100% clear these days when the ‘guid’ is actually used, but it should be the “File URL” you see when you click edit on an item. BUT wordpress may be constructing that from somewhere. have you the SQL skills to find the ‘guid’ field of a particular moved media item?

    also it would be good to know the paths you see and have set on the RU options page.

    Cheers

    Hi Alan,
    Thank you for the speedy response.
    As reported in my initial post “(2) when I reselect Edit in the Media Library, the File URL reflects the new directory path to the recently moved file.”

    I am now re-checking the MySQL _posts table… Ahhh!

    OK, so I confirm that the GUID is updated when a file is moved using RU 0.13, and the updated GUID in the MySQL _posts Table matches exactly what is reported in the Media Library Edit GUI’s “File URL” field. And these updated GUIDs do indeed work – connecting to them in a browser displays the media file.

    However I defined the RU folders in the RU 01.3 Settings page as _peer_ to wp-content/:

    Default Location: /dev/ddnt/wp-content/uploads
    Directory A: /dev/ddnt/dir1/dir2/
    Directory B: /dev/ddnt/dir3/dir4/

    The wordpress URL in the WP 2.8 General settings is: http://mydomain.com/dev/ddnt

    But the GUID entry in the _posts table and displayed in the Media Directory Edit window, both write the URL as if dir1 and dir3 were subfolders _inside_ the wp-contents directory, viz:

    http://mydomain.com/dev/ddnt/wp-content/dir1/dir2/filea.pdf
    http://mydomain.com/dev/ddnt/wp-content/dir3/dir4/fileb.jpg

    And yet these URL strings still work!? Hmm. Is there some URL rewriting going on at my end? Regardless, I’m assuming that I need to move dir1 and dir3 _inside_ wp-content directory. I’m trying that now…

    So sorry about the confusing previous note – I left out a directory level out in the previous explanation. Anyhooow, here’s my update…

    Question: Should the RU 0.13 folders be sub-folders of ‘wp-content/uploads/’?
    I have setup two sub-folders, ‘dir1’ and ‘dir2’, in ‘uploads’ and defined these in the RU 0.13 settings.

    I have simplified my setup, viz:

    1) WordPress URL in the WP 2.8 General settings is: http://mydomain.com/dev/ddnt

    2) RU 01.3 Settings
    Default Location: /dev/ddnt/wp-content/uploads
    Directory A: /dev/ddnt/wp-content/uploads/dir1/
    Directory B: /dev/ddnt/wp-content/uploads/dir2/

    3) Media Library GUI lets me move files from the ‘Default Location’ to ‘Directory A’ or ‘Directory B’

    4) The Media Library Edit view shows that files I move have updated File URLs:
    http://mydomain.com/dev/ddnt/wp-content/uploads/dir1/file1.jpg

    5) WP 2.8 _posts Table shows that the GUID is the exact same string as (4). So RU _is_ updating the GUID, and this is being reported correctly in the Media Library Edit view.

    6) Media Library GUI filter “Directory A” returns NO files.
    Media Library GUI filter “All folders” returns ALL files including ‘file1.jpg’ which
    is in the RU subfolder ‘dir1’

    thanks again,
    …fn

    Should the RU 0.13 folders be sub-folders of ‘wp-content/uploads/’?

    Well WP would much rather that is the case — and does assume that that is the case in a number of places in the code — but I have been writing RU so that you shouldn’t have to be constrained to this.

    thanks for all the info and for trying out variations. sadly i can’t think what circumstances might be leading to the filter failing in your most recent of cases. I will try to think up some good debugging code you could add to the plugin to work out where it’s tripping up.

Viewing 15 replies - 31 through 45 (of 61 total)
  • The topic ‘Plugin relocate-upload – Not quite working in 2.7’ is closed to new replies.