Hey! Thanks so much for putting this sandbox project together, you really saved my bacon on a build for a client recently who needs to be able to update PDF files but maintain the exact same filename / path.
Basically, I spotted a minor bug after uploading a load of files with the multi-upload widget and then switching over to the default file field widget for uploading files. I noticed that the file replacing function didn't validate due to the paths to the original files being encoded. On line 405 I added a urldecode() around str_replace($GLOBALS['base_url'] argument in the message array. It means that files uploaded via a different widget should still maintain their original filename this way.
line 405 in the .module file now reads:
$message = t('<p>Use the field below to upload a replacement for the file at the following path:<br/><strong>@url</strong></p><p>This action cannot be undone. The replacement file will completely overwrite the original. Upon completion any links or internal system references to this path will point to the new file.</p>', array('@url' => urldecode(str_replace($GLOBALS['base_url'], '', file_create_url($file_orig->uri)))));
Not sure if that's of any use to you or anyone else but it certainly sorted out the issue for me.
Thanks again for making a very very useful module for doing direct file replacement.
Alex
Comments