def file_upload_view(request):
 form_data = request.POST.copy()
 form_data.update(request.FILES)
 if (isinstance(form_data.get('file_field'), UploadedFile) and isinstance(form_data['name'], unicode)):
  if (os.path.dirname(form_data['file_field'].name) != ''):
   return HttpResponseServerError()
  return HttpResponse('')
 else:
  return HttpResponseServerError()

def file_upload_view ( request ) : form_data = request . POST . copy ( ) form_data . update ( request . FILES ) if ( isinstance ( form_data . get ( 'file_field' ) , UploadedFile ) and isinstance ( form_data [ 'name' ] , unicode ) ) : if ( os . path . dirname ( form_data [ 'file_field' ] . name ) != '' ) : return HttpResponseServerError ( ) return HttpResponse ( '' ) else : return HttpResponseServerError ( )
check that a file upload can be updated into the post dictionary without going pear-shaped .