Force Media Upload

Hi,

I think about make a file-upload required when posting an Update with Buddypress. Is this possible?
do I need some extra code?

If no file is selected with the Update an Errormessage should be shown: “Please Upload a file” (f.ex.)

Thanks

@fabian.kainz.7, By default it is not possible. You need to write some extra code. You can do that by applying JavaScript validation. This object -> objUploadView.uploader.files will give you array of files. Check the length of this array for validation.

Sounds good i'll try it.

where can i add the code?

In your theme's js file.

got a little problem with this :(

it already checks for the length, but I cannot prevent buddypress from posting the activity update. The error message is shown but the update is posted anyway. An Idea?

You need to return false which will prevent it from further processing.

I already tried this in post-form.php file. onsubmit it should check if the string is empty if yes return false. but it is published anyway.