Ticket #899 (closed enhancement: fixed)

Opened 7 years ago

Last modified 5 years ago

Wishlist item: hooks for file uploads

Reported by: gbhugo Owned by:
Priority: high Milestone: 2.1
Component: Administration Version: 1.6
Severity: normal Keywords: needs-patch
Cc: dwc

Description

This hook would be called with the uploaded file, a flag that tells about wether a thumbnail was created and the caption that was given for the upload. The ratio: plugins could hook into this one to get notified when images are uploaded and could feed that data into their databases. Otherwise they can only scan the wp-content directory but the caption is lost if the user isn't using cut-and-paste to transfer it. Would be quite handy for a plugin I am currently working on.

XMLRPC uploads via metaWeblogAPI can call the same hook but just provide an empty string for the caption (as there is no caption provided by the API call).

Change History

  • Patch set to No
  • Owner changed from anonymous to skippy
  • Priority changed from normal to low
  • Version changed from 1.5 to 1.6
  • Status changed from new to assigned

A hook on file upload would be nice. No such  hook or filter exists, currently.

  • Keywords bg|2nd-opinion bg|needs-patch added
  • Priority changed from low to high

Someone (Owen?) is working on redoing the upload functionality. It really needs a total workover. The image uploading functionality is poor... and it's something that people really expect to work well.

  • Milestone set to 1.5.2

comment:6   matt7 years ago

  • Milestone changed from 1.5.2 to 1.6

Per a recent discussion with Matt, the wp_posts.post_status value 'object' is for recording (but not storing) uploads as post children. It is used in the new image-uploading.php and there are now object handlers in functions-post.php. A file_upload action hook should be added to any uploading functions. It should only need one parameter: post_ID.

That is, unless you plan on uploading files that aren't attached to posts.

comment:8   matt6 years ago

  • Milestone changed from 1.6 to 2.1
  • Keywords needs-patch added; bg|2nd-opinion bg|needs-patch removed
  • Owner skippy deleted
  • Status changed from assigned to new

Removing assignment to Skippy.

  • Status changed from new to closed
  • Resolution set to fixed

Fixed some time ago. Relevant hooks:

wp_handle_upload

add_attachment

edit_attachment

Note: See TracTickets for help on using tickets.