Is custom behaviour possible when asynchronously uploading?

I'm using Plupload and making use of wp-admin/async-upload.php to allow my website's users to upload images from the front-end asynchronously. The default behaviour of that particular script is for files to be uploaded to the media library as posts (of post_type attachment). Users may upload as many files as they like (each file upload creates a new post).

My aim is to allow users to continue to upload in this way but instead of creating a new post on each upload, I'd like the previously uploaded file to be replaced. Hence, users will have at most 1 post each in the system.

I don't see anything in wp-admin/async-upload.php that will allow me to hook in and add this custom behaviour.

My question

Is there a way to modify the default behaviour of asynchronous uploads? Or will I need to write my own async-upload.php script?

Topic plupload ajax uploads php Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.