Force Media Upload


#1

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


#2

@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.


#3

Sounds good i'll try it.

where can i add the code?


#4

In your theme's js file.


#5

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?


#6

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


#7

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.


#8