def upload_media(request, form_cls, up_file_callback, instance=None, **kwargs):
 form = form_cls(request.POST, request.FILES)
 if ((request.method == 'POST') and form.is_valid()):
  return up_file_callback(request.FILES, request.user, **kwargs)
 elif (not form.is_valid()):
  return form.errors
 return None

def upload_media ( request , form_cls , up_file_callback , instance = None , ** kwargs ) : form = form_cls ( request . POST , request . FILES ) if ( ( request . method == 'POST' ) and form . is_valid ( ) ) : return up_file_callback ( request . FILES , request . user , ** kwargs ) elif ( not form . is_valid ( ) ) : return form . errors return None
uploads media files and returns a list with information about each media: name .