I am using the plugin, Relocate Upload so that I can move some uploaded files to a specified folder.
I get the following error when I move a file...
Warning: Illegal string offset 'sizes' in /home3/home1081/public_html/wp-content/plugins/relocate-upload/relocate-upload.php on line 56
Warning: Cannot modify header information - headers already sent by (output started at /home3/home1081/public_html/wp-content/plugins/relocate-upload/relocate-upload.php:56) in /home3/home1081/public_html/wp-content/plugins/relocate-upload/relocate-upload.php on line 73
Warning: Cannot modify header information - headers already sent by (output started at /home3/home1081/public_html/wp-content/plugins/relocate-upload/relocate-upload.php:56) in /home3/home1081/public_html/wp-content/plugins/relocate-upload/relocate-upload.php on line 74
...here is the relevant portion (I think) of the plugin php file...
// attempt to move the file
if(file_exists($new_path))
$result="FAIL: move will overwrite an existing file";
else if (rename($attachment_path,$new_path))
{ $result="WAIT";
// move any thumbnails too
$pm=get_post_meta($id,"_wp_attachment_metadata", true);
if ($pm['sizes'])
foreach($pm['sizes'] as $size=>$pm_size)
rename(dirname($attachment_path)."/".$pm_size['file'],dirname($new_path)."/".$pm_size['file']);
// update the metadata to reflect the new location
$pm['file']=$new_path;
update_post_meta($id,"_wp_attachment_metadata",$pm);
update_post_meta($id, "_wp_attached_file", $new_path);
// update the post/attachment GUID field
$new_guid = str_replace( str_replace(SERVER_DOC_ROOT,"",$attachment_path), str_replace(SERVER_DOC_ROOT,"",$new_path), $attachment_guid );
$attachment_record = & $wpdb->get_row($wpdb->prepare("UPDATE $wpdb->posts SET guid='%s' WHERE ID = %d ", $new_guid, $id));
// let the client know all is well, and what the new guid is
$result="DONE: $new_guid";
}
header("HTTP/1.0 200 OK");
header('Content-type: text/plain;');
echo "$result";
exit;
}
These errors only come up when I am moving a media file that is NOT an image file.
Aucun commentaire:
Enregistrer un commentaire