This plugin is great, but I don’t like the default image caption. It exposes the file directory on the server. Could disabling this be added to the settings page?
Thanks!
]]>I like the idea of plugin, but unfortunately it doesn’t work with cyrillic (Russian) filenames. It spoiled filename for russian language files.
I decided to mention firstly here before putting one start to plugin’s rating. Will problem be solved?
Hi
This is a conflict, with WPML. For anyone spending hours of a spooky problem.
After last updates of WPML from Version 3.1.4 (worked well) to WPML Version 3.1.5 (breaks) and higher dis plugin breaks the translation media functionality in WPML. It seems the filename cleaning comes between the default lang and the translated languages.
Im trying to solve this issue and track the ordering of hooks.
]]>I was wondering if: “EXIF header malware/backdoor sanitization!” automatically removes EXIF data from images?
If not, could someone please point me to the best solution for removing EXIF data automatically while uploading images. Help please. Thanks.
]]>Hi Paolo,
Uploadplus is absolute awesome, thanks for sharing it.
I have a weird problem with UP 3.3.1 version: it puts the absolute path to the file in description media field.
Now, I love that it puts the original filename as description because handy for search engines but it puts the abs path too, like:
“/mounted storage/home258/sub028/fc53856 MXLK/site.com/xxx/ddddd/wp content/uploads/file name”
instead only: “file name”
This is real annoying when use images for galleries, that often show descriptions.
UP settings are: dashes, lowercase, custom prefix (but also with other prefixes), no translit.
Of course, none of the images has exif data, prior to upload, this is the server path.
Can you reproduce this issue?
Thanks in advance
I just updated the plugin, but uploads failed because it assumed the exif_read_data() function is available (which it isn’t on my server installation).
I quick fixed this adding a function_exists(‘exif_read_data’) to the if statement on line 308 of core.class.php.
]]>Hi,
I cant find any change log, and after testing the update, it still has the un-logic stuff I modified away from the last version.
Example with using “-” and lowercase, no prefix.
Concider:
From disk: _My blogNamephoto_1234-.JPG
Should return filename : my-blognamephoto-1234.jpg
(And the title : My blognamephoto 1234)
But this new version still returning as the old one:
From disk: _My blogNamephoto_1234-.JPG
returns filename : _my-blognamephoto_1234-.jpg
(With the title : _My-blognamephoto_1234-)
prefixmypicture.jpg
and return prefix-mypicture.jpg
My final question is what changes are made in the code as a construction? Should we just keep our own modded version or re-modificate the new update.
]]>This is still one of our Core plugins, we love it!
Hi,
Using blogname do not clean proper name. I got this.
wpnicec?ted039azur-13_milo.jpg
The french ? is still left.
]]>when there is a page call https://www.mysite.com/potatoes and I upload file pototoes.pdf, the original pages is hidden a replaced by file page potatoes. After deleting potatoes.pdf, all is OK.
]]>Hi.
It would be possibile to append username to uploaded files?
It’s good for multi-users environment.
UploadPlus 3.3 – upcoming release – will finally support multiple languages, now we just need some translator ??
If you’re willing to help feel free to join us. Thank you!
]]>Hi there! This should be pretty easy trick to do. However I got no idea how to do this. I like this plugin, does the job very well. However it’s missing the most important feature for me: Changing the whole filename and not just giving it a prefix. I would like my original filename like PICTURE3000.jpg to be renamed something random like f8ds9fyh.jpg or something else like a date for example 2406201301.jpg.
Would it be possible to give me a quickfix for this? I would be very happy to get this feature working asap. ??
]]>Hi there and thank you for your great work,
What are the possible options for the custom prefix box? Can it take any loop variables or just plain text?
Regards,
Alex.
Hi, This is a great base plugin!
My projects love it, and I need it to work while waiting for update. Thanks for your nice work with this plug!
To get this plugin to work for a lot of customers I did the following tweaks and suggest some logic for updates to the authors. I run it on diffrent 50 blogs, langs, and with those changes, my clients don complain any more about their filenames… This is only suggestions, cant use github, so posting here for any one to use.
First, the order of cleanup self::functions
If I choose to replace all lowercase with “-” as separator I don wanna end up with :
My-blognamephoto_1234-.jpg
instead
my-blogname-photo-1234.jpg
The separator would be consistant and also replace old separator like “_” in this case.
By changing the order of the cleanup functions
$file_name = self::_clean_global( $file_name );
$file_name = self::_add_prefix( $file_name ); // QQ
$file_name = self::_clean_filename( $ext, $file_name );
$file_name = self::_clean_case( $file_name );
//$file_name = self::_add_prefix( $file_name ); // QQ Moved up
And reverse the separators cases :
switch( $cleanlevel[0] ):
case "dash":
default:
$file_name = preg_replace ('/[-\s]+/', '-', $file_name);
$file_name = str_replace('_', '-', $file_name); // QQ
$sep = "-";
break;
case "space":
$file_name = preg_replace ('/[-\s]+/', ' ', $file_name);
$file_name = trim($file_name); // QQ
$sep = "-";
break;
case "underscore":
$file_name = preg_replace ('/[-\s]+/', '_', $file_name);
$file_name = str_replace('-', '_', $file_name); // QQ
$sep = "_";
break;
endswitch;
…adds a more logic for most users.
Second, The functions are renundant
For all the filename cleaning handling, I suggest running by wp core sanitize_file_name()
means, other plugin like Enable Replace Media, buddypress etc etc get cleaned by Upload plus.
wp_handle_upload()
is usingwp_handle_upload_prefilter()
ANDwp_unique_filename()
and the latter isusing sanitize_file_name()
So instead of using add_action for wp_handle_upload()
, and rewrite the file all over again, just focus on sanitize_file_name(), and then skip option “B” wp_unique_filename()
. Its already parsed. Safe and WP style.
Finally,
I added an option to add date taken by camera as prefix if custom prefix is set to exif
. Many clients need to know when they actually took the picture… This is the only reason to still use wp_handle_upload_prefilter()
.
Dots, are preserved, for ex upload-plus-v-1.2.3.zip
but not for images, so they dont endup with upload-plus-image.bmp.jpeg
or files with dubble dots like upload-plus-revision-1..2.3.doc
Summary : in uploadplus.php
function __construct() {
#$core = new SWER_uploadplus_core();
add_action( 'admin_init', array( &$this, '_admin_init' ) );
add_action( 'wp_handle_upload_prefilter', array( 'SWER_uploadplus_core', 'wp_handle_upload_prefilter' ), 1, 1);
add_action( 'add_attachment', array( 'SWER_uploadplus_core', 'add_attachment') );
add_filter( 'sanitize_file_name', array( 'SWER_uploadplus_core', 'sanitize_file_name') );
}
The rest of tweaks in core.class.php
// bottom of _add_prefix function
$custom = get_option('uploadplus_customprefix');
if( $custom !== '' ):
if(strtolower($custom) == 'exif'){
$return_file_name = $file_name;
} else {
if(isset($GLOBALS['UPLOAD-PLUS-EXIF'])) unset($GLOBALS['UPLOAD-PLUS-EXIF']);
$return_file_name = $custom.$sep.$file_name; // QQ Separator added
}
else:
$return_file_name = $file_name;
endif;
AND
function wp_handle_upload_prefilter( $arr ){
//$name = self::upp_mangle_filename( $arr['name'] );
if(isset($GLOBALS['UPLOAD-PLUS-EXIF'])) unset($GLOBALS['UPLOAD-PLUS-EXIF']);
//QQ
if ( is_callable('exif_read_data') && $arr['type'] == 'image/jpeg' ) {
$exif = exif_read_data($arr['tmp_name'], 0, true);
foreach (array('DateTimeDigitized', 'DateTimeOriginal', 'FileDateTime') as $key) {
if (isset($exif['EXIF'][$key]) && trim($exif['EXIF'][$key])) {
$prefix = trim($exif['EXIF'][$key]);
}
}
if(isset($prefix)) {
list($date, $time) = explode(' ', $prefix);
list($y, $m, $d) = explode(':', $date);
$prefix = "{$y}-{$m}-{$d}";
$GLOBALS['UPLOAD-PLUS-EXIF'] = $prefix;
unset($prefix);
}
}
return $arr;
}
AND
function sanitize_file_name( $filename, $filename_raw ){
global $sep;
$new_name = self::upp_mangle_filename($filename);
if(isset($GLOBALS['UPLOAD-PLUS-EXIF'])) {
$new_name = $GLOBALS['UPLOAD-PLUS-EXIF'].$sep.$new_name;
unset($GLOBALS['UPLOAD-PLUS-EXIF']);
}
return $new_name;
}
AND THE ugly but working dots fix
function _clean_filename( $ext, $file_name ){
$file_name = str_replace('.'.$ext, '', $file_name);
if(in_array(strtolower($ext), array('jpg', 'tiff', 'jpeg', 'tif', 'png', 'bmp', 'gif') ) ) $file_name = str_replace('.', '-', $file_name);
else $file_name = str_replace('.', 'qQQppQQq', $file_name);
$file_name = str_replace('qqQQppQQ', '', $file_name);
$file_name = preg_replace('~[^\\pL0-9_]+~u', '-', $file_name);
$file_name = preg_replace ('/^\s+|\s+$/', '', $file_name);
$file_name = str_replace('qQQppQQq', '.', $file_name);
$file_name = $file_name.'.'.$ext;
return $file_name;
}
AND AT LAST
The add_attachment() action has never worked ok, so I replaced it by adding a filter call. The same filter can be use consistant by other plugin, like rename files, buddypress m.m. So I just wanna decide overall what also upload plus should do with the attachment title name.
function add_attachment( $id ){
$obj = get_post( $id );
$title = $obj->post_title;
$title = apply_filters( 'upload_plus_add_attachment_title', $title );
// Update the post into the database
$uploaded_post = array();
$uploaded_post['ID'] = $id;
$uploaded_post['post_title'] = $title;
wp_update_post( $uploaded_post );
return $id;
}
in my theme functions.php
function ua_sanitize_file_title($title){
$char_array = array();
$char_array[] = '-';
$char_array[] = '_';
//$char_array[] = '.';
$char_array[] = '~';
$char_array[] = '+';
$title = str_replace($char_array, ' ', $title );
$title = preg_replace("/\s+/", " ", $title);
$title = str_replace(array('.jpg', '.tiff', '.jpeg', '.tif', '.png', '.bmp', '.gif'), '', $title);
$title = ucfirst( strtolower( $title ) );
return $title;
}
add_filter( 'upload_plus_add_attachment_title', 'ua_sanitize_file_title');
Be my guest!
]]>Hi,
i do not have anything under Option-Media (as mentioned in https://www.ads-software.com/extend/plugins/uploadplus/installation/ ) as for this plugin to set it… And that is why it doesnt work – it did not convert any file name now. Thank you.
Hi there, this is such a good plugin, but i find a little problem here.
When I set in “custom prefix” text field. the image name result always get doubled.
For example I have Picture with name Technologyka.jpg and I set “Image-” to the “custom prefix” text field.
When I upload the image, the filename results is Image-Image-Technologyka.jpg.
I just want the “Image-” appear just one time.
Can you please fix this issue?
Thanks Before ??
]]>Any plans to use post title or slug as file name?
]]>Could be unicode letters converted into their ascii associates instead of dash? Like EU peníze st?edním ?kolám.doc –> EU-penize-strednim-skolam.doc? It looks really strange this EU-pen-ze-st-edn-m–kol-m.doc
There might be some php function/script that could do that….
Thanks a lot!
Hi and thank you for your excellent work.
We have tried it on websites with the latin characters and works out of the box. ??
Still. When trying to use fnc on images like this one or this (that is the greek alphabet) all we get is underscores. Please have a look either by downloading the file and trying to upload it to the media library or saving the file using the Insert from URL or the Grab and Save plugin.
It would be great if we could use it for NON-Latin characters (greek in our case).
Can you please have a look?
Thank you.
Hi all,
Upload+ it’s great, so I try to ask for another feature ??
What about to automatically copy the title on Alt and Description fields?
Very often not caring users forget (or don’t know that have to) to add an Alt title and/or a Description and should be useful if, at least, it could be similar to title.
Not the best, of course, but better than empty fields, in any case users can always change it.
What about?
Thanks in advance
Mac
]]>Hi, I just tried this plugin, that it’s really useful so I ask for another feature that IMO it need.
There is a prefix chooser and has good functions but are all pre made, what I miss is to input a custom string instead to choose one of them.
Also, I tried to set all lowercase and add a Blog Name prefix but result is that original filename is converted and blog name, that I cannot change, are capitalized so with some uppercase that I’d prefer avoid.
With a custom string this can be solved and add more flexibility.
What about?
Thanks in advance
Mac
]]>Hi all,
looking for this plugin from administration, plugin installation, it’s impossible to find out it, with any search string, starting from “upload+”, to “upload” and many other.
To install need to download and upload.
I think that should be better to give it a more long name and avoid “+”
Something like: “Rename Upload Plus” could work.
My 2 eurocents
I added option “wordpress style” wich adds the suffix to the filename just like the wordpress uploader does it. If the filename is not unique, then a number will be added to the filename before the extension, and will continue adding numbers until the filename is unique. I think its better then the looong timestamps etc. I hope the author will check this out.
In the plugins uploadplus.php
added to the switch:
$standard = get_option('uploadplus_prefix');
switch($standard):
//here goes the standard code
//and below what i added
case "B":
$uploads = wp_upload_dir();
$dir = ( $uploads['path'] );
$filename = wp_unique_filename( $dir, $file_name, $unique_filename_callback = null );
$file_name = $filename;
break;
and here:
$otherstyles = array(
"7" => '[random (mt-rand)] '.mt_rand().$sep,
"8" => '[random md5(mt-rand)] '.md5(mt_rand()).$sep,
"9" => '[blog name] '.str_replace( array(".", " ", "-", "_") ,$sep,strtolower(get_bloginfo('name'))).$sep,
"A" => '[short blog name] '.str_replace( array(".","_","-"," "),"",strtolower(get_bloginfo('name'))).$sep,
"B" => 'wordpress style' // added this option
);
]]>